Posted By

jonhenshaw on 10/11/06


Tagged

date footer


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

pufftenticle
jamesming


Automatic Date for Footer


 / Published in: JavaScript
 

You can use this script to always keep the copyright notice on the footer of your website current. For example, instead of having to update the year at the beginning of each year, this script will display current year. I'm sure there's an easier way of doing this, but I ran across it tonight and thought it was a clever idea. When putting it in your code, it would look something like "Copyright 2001[script goes here]"

  1. <script language="JavaScript">
  2. var d=new Date();
  3. yr=d.getFullYear();
  4. if (yr!=2002)
  5. document.write("-"+yr);
  6. </script>

Report this snippet  

You need to login to post a comment.