随机数

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <div id="one" style="color:red ;font-size:10cm; text-align:center;">0</div>
        <script>
        one=document.getElement("one")
        var i=1;
        var dt=null;
        function stop(){
            clearInterval(dt)
        }
        function star(){
            dt=setInterval(function(){
                one.innerText=Math.round(Math.random()*100)
            },50)
        }
        </script>
        <button onclick="star()">开始</button>
        <button onclick="stop()">结束</button>
        
    </body>
</html>

原文地址:https://www.cnblogs.com/wangxirui/p/6371460.html