helpstuff.com

Helping end-users since 1981

Using JavaScript to add a copyright to HTML pages

In the old days (say, 1996), developers entered copyright information by typing it at the bottom of every HTML page. It was frustrating to make sure that it looked the same on every page and changes, of course, took a long time because every page had to be modified. A copyright script, using an external .js file, lets you change your copyright information once and have it reflect immediately on all HTML pages.

Enter the following information in your external .js file (change my information to reflect yours) or download the sample copyright.js file.

function copyright() { 

document.write('<div align="center">')

// type the following statements on one line (no hard returns)

document.write('Copyright 1998-2005 JTF Associates, Inc.<br>') 

document.write('For more information, email <a href="mailto:address@domain.com">JTF Associates,Inc.</A>.') 

document.write('</div>') }

Before the </head> tag, enter the following information. Be sure to change filename.js to the name of your .js file.

<script language="JavaScript"type="text/javascript" src="filename.js"></script>

Before the </body> tag (or where you want the copyright information to display), enter the following information. Make sure the name of the function matches the name you entered in the .js file.

<script language="JavaScript" type="text/javascript">copyright()</script>

You can see this in action in the Sample Script File, which you are welcome to download.

In this section...

Using secondary windows in HTML Help and WinHelp

Creating a link from a secondary window to the main window in HTML Help

Do you suffer from Compulsive Obsessive Pagination Syndrome (C0PS)?

Using the Mark of the Web (MOTW)

Think WYSIOP, not WYSIWYG