including with innerHTML

M

marco.stolle

Hi,

I know how to use innerHTML but I want to use it to dynamicly include
other text files on the web server.

I know this can be done by php (did that before) and SSI (not yet
done) but since I moved my personal site to the site of the provider
that does not support php and SSI I'm looking for a system that always
works under html + javascript

thanx

Marco
 
B

Bone Ur

Well bust mah britches and call me cheeky, on Sun, 11 Nov 2007 07:57:17 GMT
scribed:
Hi,

I know how to use innerHTML but I want to use it to dynamicly include
other text files on the web server.

I know this can be done by php (did that before) and SSI (not yet
done) but since I moved my personal site to the site of the provider
that does not support php and SSI I'm looking for a system that always
works under html + javascript

thanx

Marco

You can use:

<script type="text/javascript" src="text.txt"></script>

and put it in your page where you want the text. In "text.txt" do a
document.write. (Avoid xhtml.)
 
M

marco.stolle

Well bust mah britches and call me cheeky, on Sun, 11 Nov 2007 07:57:17 GMT
scribed:




You can use:

<script type="text/javascript" src="text.txt"></script>

and put it in your page where you want the text. In "text.txt" do a
document.write. (Avoid xhtml.)

Ok thanks,

I also found a way to use httprequests http://www.boutell.com/newfaq/creating/include.html
I'm also exploring that path

in order to include the pages in my main page I would use links with
variables in so that you can give someone a link that works like

www.mysite.com?page=thebodypage.htm

where thebodypage.htm is the page I want to include

how can I filter the variables in the link with javascript ( in php
there is the $_GET variable)

thanx

Marco
 
M

marco.stolle

Last question also found on www.boutell.com , great site

filter the url by window.location.search that gives everything
starting with the questionmark

Marco
 
A

André Gillibert

in order to include the pages in my main page I would use links with
variables in so that you can give someone a link that works like

www.mysite.com?page=thebodypage.htm

I think you meant: http://www.mysite.com/getpage?page=thebodypage.htm
Why using this strange URI syntax?

http://www.mysite.com/thebodypage

Is a much better URI.
where thebodypage.htm is the page I want to include

So, if you want to include a specific static page, you don't need server
side scripting.
how can I filter the variables in the link with javascript ( in php
there is the $_GET variable)

Which variables?
The URI parameters of a request that hasn't yet been sent? Not possible.
The URI parameters of the current page if it's dynamic and uses
parameters? In that case, since the page is dynamic, write these
parameters in the page, at the adequate places, from the server side
script.

Beware: AJAH breaks most features of browsers: Printing, bookmarking, any
form of history (including the great Opera feature that searches in the
history), links panel, back & forward buttons, address copying, offline
browsing and local page saving, sessions, source viewing, address bar
navigation (i.e. manually editing the URI to access a different resource
or a previously seen resource, or a higher level "directory"),
multi-windows browsing, the right of disabling JavaScript and/or
XmlHttpRequest for privacy or security reasons and features that haven't
yet been invented, relying on the document model. It also breaks search
engine bots and produces inaccessible pages. Only the two or three most
popular full-featured browser with default settings set can access the
pages.

If nothing is dynamic on the server side, then, most probably, AJAH is a
bad thing, as static documents could most probably be served to the client.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top