-
-
Save azend/8104834 to your computer and use it in GitHub Desktop.
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
<!-- A fairly normal copyright stamp with placeholder for current year --> | |
<p>© Copywright <span class="copyrightYear"></span>, All rights reserved.</p> | |
<!-- Copywright date injection --> | |
<script type="text/javascript"> | |
(function() { | |
function injectCopywrightDate() { | |
var year = new Date().getFullYear(); | |
var placeholders = document.getElementsByClassName('copyrightYear'); | |
for(var placeholder in placeholders) { | |
if (placeholders.hasOwnProperty(placeholder)) { | |
placeholders[placeholder].innerText = year; | |
} | |
} | |
} | |
function onLoad(e) { | |
injectCopywrightDate(); | |
} | |
// Handle browser inconsistency (cough.cough.IE..) | |
if (window.addEventListener) { | |
window.addEventListener('load', onLoad); | |
} | |
else if (window.attachEvent) { | |
window.attachEvent('onload', onLoad); | |
} | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment