js倒计时跳转

<script language="javascript">
<!--   
var maxtime = 2;//按秒计算,自己调整! by hkshadow QQ 2765237   
var hiddenid = document.getElementById('hiddenid').value;
function CountDown(){   
 if(maxtime>=0){   
 seconds = maxtime--; 
 msg = seconds+"秒后跳转...";   
document.getElementById('timer').innerHTML=msg;
}   
 else{   
	clearInterval(timer);   
	//P.cancel();   
 top.location = "/wedding/main/bidinginfo.php?id="+hiddenid;
 }   
}   
timer = setInterval("CountDown()",1000);   
//-->   
</script>

<div>
<input type="hidden" id="hiddenid" value="<?php echo $result['aid']?>"  />
<span style="color:#F00; line-height:45px; font-size:14px;"><center><B>恭喜您,投标成功</B></center></span>.
<span style="color:#F00;font-size:14px;"><center><p id = "timer">3秒后跳转...</p></center></span>.
<span style="color:#F00;font-size:14px;"><center><a href="#none" onclick="P.cancel();"/>立即跳转</a></center></span>.
</div>

Leave a Reply

(will not be published)