1. html代码
<head>
<style type="text/css">
#divcontent {
width: 900px;
background-color: #FCFDEF;
border: 1px solid #EEEDDB;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
</style>
</head>
<body onload="startSecond()">
<div id="divcontent">
<table width="850px" border="0" cellspacing="0">
<tr>
<td style="padding:30px; text-align:center"><table width="60%"
border="0" cellspacing="0" style="margin-top:70px">
<tr>
<td style="width:98">
<img src="images/success.jpg" width="128" height="128" />
</td>
<td style="padding-top:30px">
<font style="font-weight:bold; color:#FF0000">注册成功,别忘记激活帐户啊</font><br />
<br/>
<a href="index.jsp"><span id="second">5</span>秒后自动为您转跳回首页</a>
</td>
</tr>
</table>
<h1> </h1></td>
</tr>
</table>
</div>
2. js控制定时跳转到主页代码
<script type="text/javascript">
var interval;
function startSecond() {
interval = window.setInterval("changeSecond()", 1000);
};
function changeSecond() {
var second = document.getElementById("second");
var svalue = second.innerHTML;
svalue = svalue - 1;
if (svalue == 0) {
window.clearInterval(interval);
location.href = "index.jsp";
return;
}
second.innerHTML = svalue;
}
</script>