<html> <body> © copyright 2007-<span id=currentYear>2013</span>. All rights reserved. <script> var thisYear = new Date().getFullYear(); document.getElementById('currentYear').innerHTML = thisYear; </script> </body> </html> |
Note: Make sure the Javascript is placed after the SPAN tag or you'll get an error for not being to find the 'currentYear' element.
Now you can sit back and relax during new year every year!
JavaScript Training in Chennai | Ecmascript 6 Training in Chennai | ES6 Training in Chennai | Angular 2 Training in Chennai | HTML5 Training in Chennai
ReplyDelete