Skip to content

Instantly share code, notes, and snippets.

@airekans
Created March 20, 2014 04:33
Show Gist options
  • Save airekans/9657311 to your computer and use it in GitHub Desktop.
Save airekans/9657311 to your computer and use it in GitHub Desktop.
A sample JS timer in HTML
<html>
<head>
<script>
window.onload = function() {
var test_elem = document.getElementById('test');
var number = 1;
test_elem.innerText = number;
setInterval(function() {
++number;
test_elem.innerText = number;
}, 1000);
}
</script>
</head>
<body>
<div id="test">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment