Picnic Website Code Tutorials

Automatically Update Copyright Date With Javascript Tutorial

This small script will automatically update to the new year without you having to lift a finger. It's better to use PHP to do this, but if you can't for whatever reason, this is a very good solution as well. If JS is off, then both dates just disapear. No harm - no fowl! You'll probably want to do as I did (on a recent project), and link to the JS file instead of it being inline as it is below. That way you can make site-wide changes with one edit. Also, you can wrap it all in an anchor if you want to make it a link. Enjoy!

The Code

Copyright &copy; <script type="text/javascript">
document.write("2006 - "+ new Date().getFullYear());
</script> websitecodetutorials.com
		

The Result

 
Copyright ©  websitecodetutorials.com
		

Sponsors

Top Donators

Friends of Mine