1. ホーム
  2. Web制作
  3. HTML/Xhtml

ダブル11クーポンのHTML実装(クーポンページを開くまでの時間設定)

2022-01-08 09:37:21

さっそくですが、直接コードを貼っておきますね。

<!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 = "Waiting for the robocall page to open";             
                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()
        {
             // Create a Date object
             var today = new Date();
             //get the year, month, day, hour, minute and second respectively
             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();
             //If it's a single number, add 0 in front of it
             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;
             //construct the string to be output
             var str = year+"year"+month+"month"+day+"day "+hours+":"+minutes+":"+seconds;             
             //Get the object with id=result
             var obj = document.getElementById("result");
             //write the content of str to the <div> with id=result
             obj.innerHTML = str;
             //Delayer
             window.setTimeout("showTime()",1000);
        }
    </script>
</head>
<body>
    <div>
        <h2>1,Synchronize computer time with BST</h2>
        <h2>2,Set the path address as the address and time of the coupon to be grabbed</h2>
        <! --<h3>grab coupon address</h3><input type="text" id=path />-->
        <h3>Grab the coupon address (be careful not to leave out http://或者https://)</h3> <! --<textarea id="path" style="width:200px;height:80px;"></textarea>-->
        <input type="url" id="path" style="width:auto"/>
        <h3>Time to grab coupons</h3>
        <input type="text" id=time1 />hour<input type="text" id=time2 />minutes
        <input type="text" id=time3 />sec
        <h2>3,click wait, then go click grab coupon</h2>
        <input type="button" id="start" value="start"/><div id="result"></div>
    </div>
</body>
</html>

概要

上記はダブル11グラブクーポンのHTML実装への小さな導入(クーポンをつかむためにページを開く時間を設定する)ですが、私はそれがあなたを助けることを願って、何か質問がある場合は、私にメッセージを与えてください、私は速やかに皆に返信されます。ここでも、スクリプトの家庭のウェブサイトのサポートに非常に感謝します