Created
January 21, 2013 04:56
-
-
Save zeuxisoo/4583699 to your computer and use it in GitHub Desktop.
javascript random effect on display the number
This file contains 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
<div id="random-area">1</div> | |
<script language="javascript"> | |
var max_random = 100, | |
random_area = document.getElementById("random-area"), | |
origin_text = random_area.innerHTML; | |
function random(max_random) { | |
var arr = "0123456789".split(''); | |
if (max_random < 0) { | |
random_area.innerHTML = origin_text; | |
return; | |
} | |
random_area.innerHTML = arr[Math.floor(Math.random()*arr.length)]; | |
setTimeout(function() { | |
random(--max_random); | |
}, 1000/25); | |
} | |
random(--max_random); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment