Update Copyright Dates using JavaScript and Clean Markup

by ian.purton

Make “Copyright 2006″ become “Copyright 2006-2007″ when 2007 arrives.

Rather than update copyright dates by hand or with server side code, it’s sometimes useful to use Javascript.

Using Javascript and the users local time we can convert the following markup.

The script below converts will convert the text to say 2006-2007 when we are in 2007.

Now we really need to add this code unobtrusively which we can do with the following markup.

Simple.

This entry was posted on Thursday, May 18th, 2006 at 5:49 am and is filed under Javascript. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

blog comments powered by Disqus