The Blog of Ryan McNair

Javascript Year Script - Copyright update

Posted: April 8th, 2009 | Author: Ryan | Filed under: JavaScript | Tags: , , |

Maintenance and Updatability of webpages are a high priority, with a little JavaScript your pages can be self-updating.

Create a new JavaScript file, call it jsyear.js and type the following code.

var theDate=new Date()

document.write(theDate.getFullYear())

Add the script to your footer

<div id=”footer”>&copy; Your Name 2000-<script type=”text/javascript” src=”jsyear.js”>, All rights Reserved</div>

This will call each time the page is loaded to get the current year and display the year in your footer, the script is useful were lots of pages have been created and the laborious task of correcting the year is needed.

Bookmark and Share

One Comment on “Javascript Year Script - Copyright update”

  1. 1 Malcolm said at 12:22 pm on May 22nd, 2009:

    Thanks always wanted to know how to cut down on time spent changing dates at the start of the new year, mind numbing task at the best of times.


Leave a Reply