欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

实现页面间简单的定时跳转  

程序员文章站 2022-07-14 13:00:09
...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/common.css">
</head>
<script type="text/javascript">

var time = 3; //跳转时限
var i = 0;
function init(url){ 
document.all.s.innerHTML = time;
timer = setInterval("document.all.s.innerHTML = time - (++i)", 1000);//显示时间
timer = setTimeout("document.location.href='" + url + "'", time * 1000); //跳转
}
</script>
<body id="common" onload="init('${url}')" >
<div id="all">
操作成功  还剩<span id="s"></span>秒自动返回 <br/>
<a href="${url}" >手动返回</a>
</div>
</body>
</html>