JS倒计时后跳转到指定网页,代码要怎么加?
<bodyonLoad="getTime()"><SCRIPTLANGUAGE="JavaScript"><!--BeginfunctiongetTime(){now=n...
<body onLoad="getTime()">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function getTime() {
now = new Date();
y2k = new Date("Oct 20 2014 10:00:00");
days = (y2k - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
if (daysRound<10)
{
daysRound="0"+daysRound;
}
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
if (hoursRound<10)
{
hoursRound="0"+hoursRound;
}
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
if (minutesRound<10)
{
minutesRound="0"+minutesRound;
}
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
if (secondsRound<10)
{
secondsRound="0"+secondsRound;
}
sec = (secondsRound == 1) ? " 秒 " : " 秒 ";
min = (minutesRound == 1) ? " 分钟 " : " 分钟 ";
hr = (hoursRound == 1) ? " 小时 " : " 小时 ";
dy = (daysRound == 1) ? " 天 " : " 天 "
document.timeForm.input1.value = " " + daysRound + dy + hoursRound + hr + minutesRound + min + secondsRound + sec;
newtime = window.setTimeout("getTime();", 1000);
}
// End -->
</script>
<b><font color="#0000FF">距离活动开始还有:</font></b>
<form name=timeForm>
<input type=text name=input1 size=70 border-style="none" style="border-bottom: 0px solid; border-left: 0px solid;border-right: 0px solid;border-top: 0px solid;font:24px arial, helvetica,sans-serif">
</form>
</body>
================================
我需要让这个JS倒计时结束后,跳转至一个指定网站页面,代码改怎么加
求代码大神告知! 展开
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function getTime() {
now = new Date();
y2k = new Date("Oct 20 2014 10:00:00");
days = (y2k - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
if (daysRound<10)
{
daysRound="0"+daysRound;
}
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
if (hoursRound<10)
{
hoursRound="0"+hoursRound;
}
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
if (minutesRound<10)
{
minutesRound="0"+minutesRound;
}
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
if (secondsRound<10)
{
secondsRound="0"+secondsRound;
}
sec = (secondsRound == 1) ? " 秒 " : " 秒 ";
min = (minutesRound == 1) ? " 分钟 " : " 分钟 ";
hr = (hoursRound == 1) ? " 小时 " : " 小时 ";
dy = (daysRound == 1) ? " 天 " : " 天 "
document.timeForm.input1.value = " " + daysRound + dy + hoursRound + hr + minutesRound + min + secondsRound + sec;
newtime = window.setTimeout("getTime();", 1000);
}
// End -->
</script>
<b><font color="#0000FF">距离活动开始还有:</font></b>
<form name=timeForm>
<input type=text name=input1 size=70 border-style="none" style="border-bottom: 0px solid; border-left: 0px solid;border-right: 0px solid;border-top: 0px solid;font:24px arial, helvetica,sans-serif">
</form>
</body>
================================
我需要让这个JS倒计时结束后,跳转至一个指定网站页面,代码改怎么加
求代码大神告知! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询