Many times when you write a simple HTML page, at the footer you'll need to include the year in the copright statement. For eg.,
Copyright © 2010 Gautham Ponnu
Many a time, in an infrequently updated site I often forget to update the year at the footer. This was until I came across this useful code snippet to generate the current year using simple javascript.
1 <script type="text/javascript">
2 var d = new Date()
3 document.write(d.getFullYear())
4 </script>
So, a typical usage of this piece of code would be like this.
1 <p>Copyright © <script type="text/javascript">
2 var d = new Date()
3 document.write(d.getFullYear())
4 </script> <a href="http://gauthamponnu.com">Gautham Ponnu</a>
5 All rights reserved.</p>
6 Please look at the code. Get inspired. Don't steal.
This will produce the above output.