Skip to content

Instantly share code, notes, and snippets.

@epl692
Created May 23, 2012 15:03
Show Gist options
  • Save epl692/2775750 to your computer and use it in GitHub Desktop.
Save epl692/2775750 to your computer and use it in GitHub Desktop.
Auto Updating Year Copywrite Code
<html>
<body>
<p id="copywrite">&copy;<span id="year">Year-it-is-now</span>. All Rights Reserved.</p>
<!-- Add onload="copywrite()" to activate -->
<button onclick="copywrite()">Current Year</button>
<script type="text/javascript">
function copywrite()
{
var date = new Date();
var target = document.getElementById("year");
target.innerHTML=date.getFullYear();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment