javascript使用定时函数实现跳转到某个页面

时间:2013-12-25    点击:115   
有时我们跳转到一个页面处理完任务,然后又回到原来的页面,这个在很多的下载网站可以看到,这样做也是为了留住用户。

这个用javascript的定时函数很容易实现。

window.setTimeout( code,time) // code 执行的代码 time 设置的时间
复制代码 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>javascript自动跳转</title>
<script type="text/javascript">
function redrect()
{
window.location = "1.html";
}
window.setTimeout(redrect,3000);// 跳转函数
</script>
</head>
<body >
<h4 style="color:#F00">这是跳转页面....</h4>
</body>
</html>
js浮点数精确计算(加、减、乘、除)
js整数字符串转换为金额类型数据(示例代码)
Jquery解析json数据详解
Jquery getJSON方法详细分析
JQuery判断HTML元素是否存在的两种解决方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved