Created
January 2, 2019 12:29
-
-
Save Rhyanz46/4e8db3031bdd39e1a87c87563bb62d44 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<p><button onclick="myMove()">Click Me</button></p> | |
<div id="mulai"></div> | |
<div id ="animate"></div> | |
<script> | |
var minutes = 1000 * 60; | |
var hours = minutes * 60; | |
var days = hours * 24; | |
var years = days * 365; | |
var saat_program_mulai = new Date(); | |
var saat_program_mulai = saat_program_mulai.getTime(); | |
var saat_program_mulai = Math.round(saat_program_mulai / hours); | |
document.getElementById("mulai").innerHTML = "saat program di mulai " + saat_program_mulai; | |
function myMove() { | |
var elem = document.getElementById("animate"); | |
var pos = 0; | |
var id = setInterval(frame, 5); | |
function frame() { | |
if (pos == 100000) { | |
clearInterval(id); | |
} else { | |
var now = new Date(); | |
var now = now.getTime(); | |
var saat_ini = Math.round(now / hours); | |
pos++; | |
if (saat_ini < hari_now) { | |
console.log("expired") | |
} else { | |
console.log("masih") | |
} | |
document.getElementById("animate").innerHTML = now; | |
} | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment