<!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; //构建要
相信看了这些案例你已经掌握了方法,更多精彩请关注Gxl网其它相关文章!
相关阅读:
h5的组织内容如何使用
H5怎样做出日历校验功能
H5怎样调用相机拍照并压缩图片
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com