• php课程---随机数


    <!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>
    <div id="sj"></div>
    <input type="button" value="开始" onclick="ShowNumber()" />
    </body>
    
    <script type="text/javascript">
    var arr = new Array(
            "0","1","2","3","4","5","6","7","8","9"
        );
    var bs = 0;
    function ShowNumber()
    {
        var bian = Math.floor( Math.random()*10);
        
        var s = document.getElementById("sj");
        
        s.innerText = arr[bian];
        
        bs = bs+1;
        
        //s.innerText = bs;
        
        if(bs==5)
        {
            window.clearTimeout(jian);
        }
        else
        {
            var jian = window.setTimeout("ShowNumber()",30);
        }
        
        
        
    }
    </script>
    </html>

    点击开始按钮后,会得到一个随机数,刷新之后还可以得到另一个

  • 相关阅读:
    C++实现base64编解码
    使用matplotlib绘制3D函数图像
    C++分治策略实现快速排序
    C++分治策略实现二分搜索
    C++生成随机数
    eBay 表结构
    mysql 流程函数
    无限极分类
    PHP 导出 Excell
    js
  • 原文地址:https://www.cnblogs.com/0927wyj/p/5205525.html
Copyright © 2020-2023  润新知