Skip to content

Instantly share code, notes, and snippets.

@tapickell
Created April 18, 2013 20:38
Show Gist options
  • Save tapickell/5416039 to your computer and use it in GitHub Desktop.
Save tapickell/5416039 to your computer and use it in GitHub Desktop.
JS timer
<!DOCTYPE html>
<html>
<body>
<p>A script on this page starts this clock:</p>
<p id="demo"></p>
<script>
var myVar=setInterval(function(){myTimer()},1000);
function myTimer()
{
var d=new Date();
var t=d.toLocaleTimeString();
document.getElementById("demo").innerHTML=t;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment