数字滚动[javascript]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<form name="myform" id="myform">
<input type="text" name="random" id="random" value="">
</form>

<script type="text/javascript">
(function(){
    var count=0;
    var hi=function(){
        var x = 10;
        while (x > 9) {
            x = Math.random();
            x = Math.floor(x * 100 / 2);
        }
        document.myform.random.value = x;
        count+=1;
        console.log(count);
        if(count<100){
            var scrollFunc=setTimeout(function(){return hi();},40);
        }
    };
    hi();    
})();
</script>

</body>
</html>

原文地址:https://www.cnblogs.com/dingyuanxin/p/3956771.html