js制作随机抽奖,(指定数字范围内随机出现一个数字)

转载请注明出处,原文链接https://blog.csdn.net/qq_45549336/article/details/115255581?spm=1001.2014.3001.5501在这里插入图片描述
在这里插入图片描述

<html>

<head>
        
    <meta charset="UTF-8">
        <title>抽奖</title>
        <style type="text/css">
        body {
            background-color:#130f40;
            font-size: 70px;
            text-align: center;
            margin: 0;
            padding: 0;
        }

        .start-button {
            width: 270px;
            height: 40px;
            border-width: 0px;
            border-radius: 3px;
            background: #1E90FF;
            cursor: pointer;
            outline: none;
            font-family: Microsoft YaHei;
            color: white;
            font-size: 17px;
           
        }

        .start-button:hover {
            /* 鼠标移入按钮范围时改变颜色 */
            background: #5599FF;
        }
    </style>
     
    <script type="text/javascript">
        var run = false;
        function count() {
            num.innerHTML = parseInt(Math.random() * 100);
        }
        function a() {
            if (true == run) {
                clearInterval(timerID);
                start.value = "开始";
                run = false;
            } else if (false == run) {
                timerID = setInterval("count()", 10);
                start.value = "暂停";
                run = true;
            }
        }
    </script>
</head>

<body>
    <div style="font-size: 250px;">
        <font id="num" face="impact" color="#eb4d4b">100</font>
        <div></div>
        <input class="start-button" type="button" id="start" value="开始抽奖" onclick="a()" />
    </div>

</body>

</html>

 

转载请注明出处,原文链接https://blog.csdn.net/qq_45549336/article/details/115255581?spm=1001.2014.3001.5501

  • 9
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值