打开一个网页,上面显示5秒钟以后跳转到其他网页,每过一秒,它就会改变(4秒钟以后跳转,3秒钟以后跳转。。。)<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title>Demo</title><script type="text/javascript">var intervalID = 0;var leftSeconds = 5;function beginTimer(){loopTimerId = setInterval( timerStep, 1000 );}function timerStep(){if( leftSeconds > 1 ){leftSeconds --;document.getElementById( "spTest" ).innerHTML = leftSeconds.toString() + "秒钟以后跳转到其他网页";}else{clearInterval( intervalID );window.location.href = "newPage.aspx";}}</script></head><body onload="beginTimer()"><div><span id="spTest">5秒钟以后跳转到其他网页</span></div></body></html>
ASP.NET中网页倒计时代码
未经允许不得转载:福利吧|福利社|fuliba » ASP.NET中网页倒计时代码
相关推荐
- 暂无文章