Created
April 29, 2013 04:31
-
-
Save haio/5479712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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