Created
January 7, 2013 19:17
-
-
Save rwbaker/4477599 to your computer and use it in GitHub Desktop.
Set the copyright year to the current year, if the current year is greater.
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
<html> | |
<body> | |
<footer> | |
<p>© <span id="copyrightYear">2013</span> Company</p> | |
</footer> | |
<script language="javascript"> | |
var copyrightDate = new Date; | |
var localYear = parseInt(copyrightDate.getFullYear()); | |
var initialYear = parseInt(document.getElementById('copyrightYear').innerHTML); | |
if (initialYear < localYear) { | |
document.getElementById('copyrightYear').innerHTML = localYear; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment