Page Headers And Footers

Web Procedure 001 - Javascript - last revised Jul 18, 2002. Lifted from NetMechanic Newsletter, May 2001, Vol 4, No. 9

For sites including the same information on many pages,

Step Action Information
1 Create a text file for the header / footer and type in the HTML code to include
  • Use proper formatting, code must be legal.
  • Only include on the code for the header or footer (<HTML> <BODY> etc. not required).
  • Cut and paste pre-existing code
2 Remove all line breaks from HTML code

Do this even if text requires more than one line to display, otherwise JavaScript errors will occur.

3 Enclose the HTML code inside a document.write statement ensuring that the HTML text is inside single quotes. Example:
document.write('<center><p>© 2002, In House Technologies Pty Ltd<br>All Rights Reserved</p></center>')
4 Save the file as a .txt file.  
5 In the HTML document, call the external files with JavaScript:
  • <script language="javascript" type="text/javascript" src="filename.txt"></script>
For headers, place script immediately after <BODY> tag.
For footers, place script just before </BODY> tag.
Back to Web Procedures Back to My Web Reference Index Back to Web Development Resources