Last active
August 18, 2017 22:56
-
-
Save dlucero23/35011481544994753807d8916f2a294a to your computer and use it in GitHub Desktop.
Auto Updating Copyright Year JS Script. Great for including in footers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>©2012<span id="autodate"></span> Siam Tek is a Trademark of Siam Tek Web Design Group, LLC, <br>POWERED BY <a href="//siamtek.com/solutions" title="Siam Tek Web Design Group - Digital Marketing for Online Businesses">Siam Tek - Tampa Bay Digital Marketing.</a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new function called newDate() | |
function newDate() { | |
//return a new Date() -- returns the current calendar year. | |
return new Date().getFullYear(); | |
} | |
// after everything else has loaded on the page, load this command: find the element (like a <span>) with the ID of 'autoupdate' and insert the dash '-' and the result of the newDate() function that returns the current calendar year. (ie. '-2017' or whatever the current calendar year is) | |
document.onload = document.getElementById("autodate").innerHTML = '-' + newDate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Everything is explained in the js comments