5秒后跳转到另一个页面的js代码

时间:2013-10-12    点击:83   
复制代码 代码如下:

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>5秒后跳转到另一个页面</title>

<script type="text/javascript">
var t = 5;
function countDown(){
var time = document.getElementById("time");
t--;
time.value=t;
if (t<=0) {
location.href="http://www.baidu.com";
clearInterval(inter);
};
}
var inter = setInterval("countDown()",1000);
//window.onload=countDown;
</script>

</head>
<body onload="countDown()">

<input type="text" readonly="true" value="5" id="time"/>

<!--也可以在这里写javascript代码,这样就不必在body标签中写onload="countDown()"。-->
</body>
</html>
js中的scroll和offset 使用比较的实例与分析
jquery判断RadioButtonList和RadioButton中是否有选中项示例
基于jquery的9行js轻松实现tab控件示例
JavaScript对象学习经验整理
js修改input的type属性问题探讨
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved