在web—Root/js/a.js
var s;
function time(){s = window.setInterval("a()",1000);//每隔一秒自动调用a()
}
function a(){
var objTime = document.getElementById("time");//获得time的对象
var time = objTime.innerText;//获得time的值
time = time-1;
objTime.innerText = time;//把新time赋给objTime里面
if(time == 0){
window.location="http://www.baidu.com";//3s过后跳转到哪里去
window.clear(s);//清空s,防止再次调用a()。即防止time减为负数
}
}
<script type="text/javascript" src="./js/a.js"></script>//在head标签下
<body οnlοad="time()">
注册成功,<span id="time">3</span>秒后跳转到首页//把时间单独分为一个区域
</body>
然后再IE浏览器中输入ip进而出现3s后自动跳转