JS n秒后自动跳转实例

<p><a href="<?php echo base_url();?>usercenter/index" id="message"></a> </p> 

<script type="text/javascript">
var time = 0;
var forward_url ="<?php echo base_url();?>usercenter/index";//某页网址
function forward_to(){
time ++;
if(time == 5){
document.location.href = forward_url;
}
document.getElementById("message").innerHTML = (5-time) + "秒后自动跳转到某页";
}
window.setInterval("forward_to()",1000); </script>
上一篇:Android由一个activity 间隔5秒自动跳转到另外一个activity


下一篇:The History of spring