Tutorial - Headers And Footers
If you have a large page that requires constant updating, it can be a rather time consuming job. If you have a series of pages that use the same top and/or bottom, when you change one, the rest need changing, and all uploading. This can take awhile to upload 200 or more files all over again, just for changing one or two lines.
We have a solution! The basic idea is to insert a tag where you want the header or footer to be on your page, this is linked to another file. The contents in that file will be displayed where you put the tag.
This feature works in all browsers, ever Netscape 2 and Explorer 3. This also saves download time for your visitors and cuts down on your transfer rate.
Now, here is the tag that you insert in your HTML file where you want the header/footer to be.
<script language="JavaScript" src="footer.js"></script>
Now, you make a file called "footer" using Notepad. Save it as footer.js js being the file extension.
Here is my footer.js file content.
document.write('<p><center><img src="grab/line.gif" border=0 width=350 height=1>'
+ '<br><font color=black><font size=2><font face=arial><center>'
+ '<a href="http://www.TheGuestBook.com/egbook/5917.gbook">Sign Guestbook</a> | </a><a href="http://www.TheGuestBook.com/vgbook/5917.gbook">View Guestbook</a> | </a><a href="http://www.jc2k.com">Home</a> | </a><a href="http://www.jc2k.com/in.html">Help</a>'
+ '<br><font color=tan>Copyright <a href="http://www.jc2k.com/contact.html">Java City 2000</a> 1997, 1998, 1999'
+ '<font size=1>');
You will notice it's written in Java Script itself, so you will need to know how to write in Java Script, however, is you just follow my content example and work it out over an hour or two, you should get there. The other important thing to remember is you can't have Java Script inside the *.js file, well, you can but it's harder.
The below content after my line comes in using the footer.js file. You can also have a header or whatever you like, just rename the js file to header.js and the tag where you want the file inserted,<script language="JavaScript" src="header.js"></script>
Here is my footer.js file, save it and add your own content... Footer File