Skip to content

Instantly share code, notes, and snippets.

@azend
Forked from anonymous/gist:8104830
Created December 23, 2013 21:19
Show Gist options
  • Save azend/8104834 to your computer and use it in GitHub Desktop.
Save azend/8104834 to your computer and use it in GitHub Desktop.
<!-- A fairly normal copyright stamp with placeholder for current year -->
<p>&copy; 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