[thelist] JS help: including a file as footer
Hershel Robinson
hershelr at netvision.net.il
Wed Jul 24 08:03:01 CDT 2002
> Now I don't know jack 'bout JavaScript, and haven't had any luck trying
> to find any good examples of how to have 'footer.js' read the contents
> of 'footer.html'
A simple answer I don't have. The complex answers are:
1 Check out:
http://www.dansteinman.com/dynduo/en/source.html
This is a page explaining one method of loading an external file into an
inline <div>. This is definitely the first place to look and you well find
your answer there and that's it. Dan's site is however, dated and may not
work for current browsers.
2 You could put the code of footer.htm directly into footer.js as a JS
variable and then write it to a <div> called footer. You then just put the
<div> called footer at the bottom of your document. When writing to the div
you will not affect the rest of the document. This method has drawbacks,
however.
3 It is possible to load an external file into a <div> in a document via JS,
but it's complex. Dan Steinman also has a page (or 2) on how do to this.
His methods are also in use in the current DynAPI 2 available from
sourceforge. The main drawback of this method is that it's complicated and
probably overkill. I write this, however, because there are those evolters
out there who don't believe it can be done. :)
Hershel
More information about the thelist
mailing list