!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. unction () { 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的 p 中去 obj.innerHTML = str; //延时器 window.setTimeout( showTime() ,1000); /script /head body h2 1,同步电脑时间和北京时间 /h2 h2 2,设置path地址为需要抢券的地址和抢券时间 /h2 !-- h3 抢券地址 /h3 input type= text id=path / -- h3 抢券地址(注意不要漏掉http://或者https://) /h3 !-- textarea id= path >以上就是html实现双11抢劵以及设定时间打开抢券页面的实例的详细内容,html教程
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。
新闻热点
疑难解答