<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>js延时自动跳转到指定页面的跳转代码</title>
<script language=javascript教程>
function gou(secs,surl){
if(--secs>0){
settimeout("gou("+secs+",'"+surl+"')",1000);
}
else{
location.href=surl;
}
}
gou(5,'http://www.111cn.net');
</script>
方法二
5是指停留5秒钟后自动刷新到url网址
<meta http-equiv="refresh" content="5; url=http://www.111cn.net">
方法三
<script type="text/javascript教程">
<!--
function go(t,url){
//t设置跳转时间:秒
//url设置跳转网址
document.write("<div id=text>本页将在<strong id=tt></strong>后,跳转至:<span id=link></span></div>");
document.getelementbyid("link").innerhtml="<a href="+url+">"+url+"</a>";
$(t,url);
}
function $(t,url){
ta = t-1;
tb = t+"000";
d = document.getelementbyid("tt");
d.innerhtml=t;
window.setinterval(function()
{
go_to(url);
},1000);
}
function go_to(url){
d.innerhtml=ta--;
if(ta<0){
document.write("正在跳转至:<a href="+url+">"+url+"</a>");
location.href=url;
}
else{
return;
}
}
//-->
</script>
<script type="text/javascript">
go(5,"http://www.111cn.net")
</script>
方法三
<script language="javascript">
location.replace("http://www.111cn.net/")
</script>
</head>
<body>
</body>
</html>