雙11搶券,寫一個自動打開頁面的html,僅僅是設定時間打開搶券的頁面


<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <style type="text/css">
        #result{
            width:500px;
            border:1px solid #CCCCCC;
            background:#FFFFCC;
            margin:50px auto;
            font-size:24px;
            color:#FF0000;
            padding:20px;
        }
    </style>
    <script type="text/javascript">
        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);
        }

    </script>
</head>

<body>
    <div>
        <h2>1,同步電腦時間和北京時間</h2>
        <h2>2,設置path地址為需要搶券的地址和搶券時間</h2>
        <!--<h3>搶券地址</h3><input type="text" id=path />-->
        <h3>搶券地址(注意不要漏掉http://或者https://)</h3> <!--<textarea id="path" style="width:200px;height:80px;"></textarea>-->
        <input  type="url" id="path" style="width:auto"/>
        <h3>搶券時間</h3>
        <input type="text" id=time1 />時<input type="text" id=time2 /><input type="text" id=time3 /><h2>3,點擊等待,然后去點擊搶券</h2>
        <input  type="button" id="start" value="開始"/><div id="result"></div>
    </div>
    
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM