Skip to content

Instantly share code, notes, and snippets.

@haio
Created April 29, 2013 04:31
Show Gist options
  • Save haio/5479712 to your computer and use it in GitHub Desktop.
Save haio/5479712 to your computer and use it in GitHub Desktop.
var interval = document.createElement('div');
interval.id = 'interval'
interval.style = 'margin-left: 600px;'
document.getElementsByClassName('code')[0].appendChild(interval);
var start = Date.now();
setTimeout(function () {
var interval_time = Math.floor((Date.now() - start)/1000);
var minutes = Math.ceil(interval_time/60 - 1);
var seconds = interval_time%60;
interval.innerHTML = "Oh, you have been cheating: " + minutes + 'minutes ' + seconds + ' seconds!!'
setTimeout(arguments.callee, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment