87,997
社区成员




<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<a id="cc" href="http://abc.efg.com:16578/system/ggwrw.hasdzv?isHuawuList=0&createUserId=0&huawuUserId=0&name=&tel=&diseases=%E6A%E9%80%89%E6A9&quality=%E6%9C%AA%E9ye%A9&datetype=2&begin={date}&end={date}"></a>
<script>
var cc = document.getElementById("cc");
var tempHref = cc.href;
function rehref() {
var d = new Date();
d.setDate(d.getDate()+1);
var str = d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2);
cc.href = tempHref.replace(/\{date\}/g,str);
var das = 24*60*60*1000;
setTimeout(rehref, das-d.getTime()%das);
}
rehref();
</script>
</body>
</html>
[/quote]大神,不好意思 我回复错楼层了 有问题的是2楼的 大神 我想请问下
var das = 24*60*60*1000;
setTimeout(rehref, das-d.getTime()%das);
das 结果是全天时间的毫秒数,d.getTime() 是我们现在距离1970年的毫秒数 为什么现在距离1970年的毫秒数 除以1天的毫秒数 然后1天的毫秒数减去这个结果 可以等于凌晨0点 如果我想指定的不是凌晨0点 是中午1点 或者 早上10年 又如何求呢 这有个什么计算公式去套吗
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<a id="cc" href="http://abc.efg.com:16578/system/ggwrw.hasdzv?isHuawuList=0&createUserId=0&huawuUserId=0&name=&tel=&diseases=%E6A%E9%80%89%E6A9&quality=%E6%9C%AA%E9ye%A9&datetype=2&begin={date}&end={date}"></a>
<script>
var cc = document.getElementById("cc");
var tempHref = cc.href;
function rehref() {
var d = new Date();
d.setDate(d.getDate()+1);
var str = d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2);
cc.href = tempHref.replace(/\{date\}/g,str);
var das = 24*60*60*1000;
setTimeout(rehref, das-d.getTime()%das);
}
rehref();
</script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<a id="cc" href="http://abc.efg.com:16578/system/ggwrw.hasdzv?isHuawuList=0&createUserId=0&huawuUserId=0&name=&tel=&diseases=%E6A%E9%80%89%E6A9&quality=%E6%9C%AA%E9ye%A9&datetype=2&begin={date}&end={date}"></a>
<script>
var cc = document.getElementById("cc");
var d = new Date();
d.setDate(d.getDate()+1);
var str = d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2);
cc.href = cc.href.replace(/\{date\}/g,str);
</script>
</body>
</html>