Created
April 18, 2014 01:52
-
-
Save hyeonseok/11020894 to your computer and use it in GitHub Desktop.
Random number, at the end of event.
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 lang="ko"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>추첨기</title> | |
<style> | |
html, | |
body { | |
height: 100%; | |
} | |
body { | |
background: linear-gradient(#0095DD, #00539F); | |
line-height: 1em; | |
} | |
p { | |
position: absolute; | |
top: 50%; | |
left: 0; | |
margin: -0.5em 0 0 0; | |
width: 100%; | |
color: #fff; | |
font-size: 20em; | |
margin: 0; | |
text-align: center; | |
} | |
</style> | |
</head> | |
<body onclick="start()"> | |
<p id="number">Click</p> | |
<script> | |
var to = 226; | |
var count = 0; | |
function num() { | |
var el = document.getElementById('number'); | |
el.innerHTML = Math.round((Math.random() * (to - 1)) + 1); | |
count++; | |
if (count > 120) { | |
return; | |
} | |
window.setTimeout(function () { | |
window.num(); | |
}, 10); | |
} | |
function start() { | |
window.count = 0; | |
num(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment