Javascript Example to update the copyright date on pages automatically so that your date is always current, including code.

This coding in Javascript will add the copyright statement between the arrows on the next line to your page:
--> <--

To get it to do this, either insert this script language in the head section of your document:
<script type='text/javascript'>
<!--
function write_date()
{
var thetime=new Date();

var nyear=thetime.getYear();


if (nyear<=99)
 nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
nyear+=1900;

document.write('Copyright &copy; 2001-' + nyear);

}
//-->
</script>

or, if you plan to include this script on multiple pages, you are better to place that portion of the script in a separate js file and then include it in your page. The alternate method would have this in the head:

<script type='text/javascript' src='your_file_name.js'></script>

and then create a file named your_file_name.js in the same directory which contains the following:

<--


function write_date()
{
var thetime=new Date();

var nyear=thetime.getYear();


if (nyear<=99)
 nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
nyear+=1900;

document.write('Copyright &copy; 2001-' + nyear);

}
//-->

The advantage of the latter method being that you can later make a change to one file, your_file_name.js, and it will appear on all of your pages.

In addition to inserting the script in the head section via on or the other methods listed above, insert this in the body section of your document where you want the copyright date to appear.
<script type='text/javascript'>
<!--
write_date();
//-->
</script>

If you like the code and use it, feel free to ignore us and forget where you got it or thank htmlfixit.com with a small donation.