zoukankan      html  css  js  c++  java
  • 抽奖JQ

    <!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="UTF-8">
        <title>抽签</title>
        <script src="jquery-3.4.1.min.js"></script>
    </head>
    <script>
        $(function () {
            var names = [
                "张三",
                "李四",
                "诸葛亮",
                "刘备",
                "曹操",
                "韩非",
                "张良",
                "卫庄",
                "盖聂",
            ];
            var time;
            var index;
            $("#start").prop("disabled", false);
            $("#stop").prop("disabled", true);
            $("#start").click(function () {
                time = setInterval(function () {
                    $("#start").prop("disabled", true);
                    $("#stop").prop("disabled", false);
                    index = Math.floor((Math.random() * 10) + 1);
                    $("#name").prop("value", names[index]);
                });
            });
            $("#stop").click(function () {
                clearInterval(time);
                $("#start").prop("disabled", false);
                $("#stop").prop("disabled", true);
            });
        });
    </script>

    <body>
        <input type="text" id="name" value="张三" style=" 250px;height: 50px;border: 2px solid black;text-align: center;
    margin-left:450px;margin-top: 100px;red;color: white; font-size: 26px">
        <input type="button" id="start" value="开始" style=" 70px;height: 35px; margin-left: 100px">
        <input type="button" id="stop" value="结束" style=" 70px;height: 35px;">
    </body>

    </html>
  • 相关阅读:
    LeetCode:25 K个一组翻转链表
    LeetCode:3 无重复字符的最长子串(双指针)
    Java——参数问题与final实例域
    Java——对象的构造
    配置远程服务器 安装iis 远程服务器网络无法连接
    未能找到元数据文件
    ef 设计model 标签
    visualsvn for vs2017 初始化错误
    resharper 2018.2.3破解
    C# winform 自定义函数中找不到Form中的控件和定义的全局变量
  • 原文地址:https://www.cnblogs.com/yeyuyuni/p/11586576.html
Copyright © 2011-2022 走看看