日期:2014-05-19  浏览次数:20397 次

求一段Javascript代码(在特定的时间把一个网页转到另一个网页)
我要在特定的时间把一个网页转到另一个网页

比如我要到2007-4-19   23:27:59就转到另一个网页,页面显示如下


当前的时间   <----如   2007-4-10   23:27:50(时间一秒刷新一次)
还剩多少时间   <------如   还剩100分100秒,   (一秒刷新一次,当小于30秒就转到另一个网页)


我不懂Javascript语法,本来想用AJAX,但是这样感觉太小题大作了。希望能得到一段性能比较好的JS脚本。

在线等/

------解决方案--------------------
很简单啊.网上一搜一大把
------解决方案--------------------
setInterval( "function() ",1000);
------解决方案--------------------
function() "就是做你的判断,转页面
------解决方案--------------------
参考: http://community.csdn.net/Expert/topic/5472/5472059.xml?temp=0.448357928753066
------解决方案--------------------
<script language= "javascript ">

test();
function test()
{
if(条件)
{
window.open( 'aa.html ')
}
setTimeout( "test() ",10000);

}
</script>
大概是这个样子!你研究一下
------解决方案--------------------
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> Untitled Page </title>
<script >
var expire;
var clock;
window.onload = function()
{
expire = new Date(2007,3,19,11,59,59);//2007-4-19 11:59:59
clock = window.setInterval(test,1000);
}
function test()
{
var current = new Date();
document.getElementById( "Label1 ").innerText = current.toLocaleString();
var left = expire.getTime() - current.getTime();
if(left < 30 * 1000)
{
window.location = "default.aspx ";
window.clearInterval(clock);
return;
}
else
{

document.getElementById( "Label2 ").innerText = Math.floor(left / 1000) + " secondes left ";
}
}
</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:Label ID= "Label1 " runat= "server " Text= " "> </asp:Label>
<br />
<asp:Label ID= "Label2 " runat= "server " Text= " "> </asp:Label>
</div>
</form>
</body>
</html>