简单的页面自动跳转 倒数计时

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>

<script language="JavaScript1.2" type="text/javascript">
<!--
// Place this in the 'head' section of your page.

function delayURL(url) {
var delay = document.getElementById("time").innerHTML;
if(delay>0){
delay--;
document.getElementById("time").innerHTML = delay;
} else{
window.top.location.href = url;
}
setTimeout("delayURL('"+url+"')",1000);
}
//-->
</script>

<body>
<center>
<h1>回复成功!</h1>
<h3><span id = "time" style=background-color: red>3</span>秒钟后跳转到主题列表,如果没跳转,请点击<a href="article.jsp">这里</a>!</h3>
<script type="text/javascript">
delayURL("article.jsp");
</script>
</center>
</body>
</html>

你可能感兴趣的:(跳转)