IT俱乐部 HTML HTML实现双11抢劵(设定时间打开抢券的页面)

HTML实现双11抢劵(设定时间打开抢券的页面)

废话不多说了,直接给大家贴代码了,具体代码如下所示:
 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    <title></title>
        #result{
            width:500px;
            border:1px solid #CCCCCC;
            background:#FFFFCC;
            margin:50px auto;
            font-size:24px;
            color:#FF0000;
            padding:20px;
        }
     
        window.onload = function () {
            showTime();
            var start = document.getElementById("start");
            start.onclick=function () {
                var path = document.getElementById("path").value;
                var time1 = document.getElementById("time1").value;
                var time2 = document.getElementById("time2").value;
                var time3 = document.getElementById("time3").value;
                start.value = "等待打开抢单页面";            
                setInterval(function () {
                    var date = new Date();
                     var hour = date.getHours();
                     var minute = date.getMinutes();
                     var second = date.getSeconds();
                    if (hour == time1 && minute == time2 && second == time3) {
                        window.open(path);
                    }
                }, 100);
            };      
        }
        function showTime()
        {
             //创建Date对象
             var today = new Date();
             //分别取出年、月、日、时、分、秒
             var year = today.getFullYear();
             var month = today.getMonth()+1;
             var day = today.getDate();
             var hours = today.getHours();
             var minutes = today.getMinutes();
             var seconds = today.getSeconds();
             //如果是单个数,则前面补0
             month  = month<10  ? "0"+month : month;
             day  = day <10  ? "0"+day : day;
             hours  = hours<10  ? "0"+hours : hours;
             minutes = minutes<10 ? "0"+minutes : minutes;
             seconds = seconds<10 ? "0"+seconds : seconds;
             //构建要输出的字符串
             var str = year+"年"+month+"月"+day+"日 "+hours+":"+minutes+":"+seconds;            
             //获取id=result的对象
             var obj = document.getElementById("result");
             //将str的内容写入到id=result的<div>中去
             obj.innerHTML = str;
             //延时器
             window.setTimeout("showTime()",1000);
        }
    <div>
        <h2>1,同步电脑时间和北京时间</h2>
        <h2>2,设置path地址为需要抢券的地址和抢券时间</h2>
         
        <h3>抢券地址(注意不要漏掉http://或者https://)</h3>
        <h3>抢券时间</h3>
        时分
        
        <h2>3,点击等待,然后去点击抢券</h2>
        <div id="result"></div>
    </div>
 
</div>

总结

以上所述是小编给大家介绍的HTML实现双11抢劵(设定时间打开抢券的页面),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对IT俱乐部网站的支持!

本文收集自网络,不代表IT俱乐部立场,转载请注明出处。https://www.2it.club/navsub/html/13710.html
上一篇
下一篇
联系我们

联系我们

在线咨询: QQ交谈

邮箱: 1120393934@qq.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部