先看效果
<script language="JavaScript">var t = 3;//设定跳转的时间setInterval("refer()", 1000); //启动1秒定时function refer() {if (t == 0) {location = "javascript:window.history.back()"; //#设定跳转的链接地址}document.getElementById(‘show‘).innerHTML = "<div style=‘margin-left:25%;‘><h1><span style=‘color:red;‘>操作失败<br/></span></h1>"+ t+ "秒后跳转回去<a href=‘javascript:window.history.back()‘>重新操作</a>!</div>"; // 显示倒计时t--; // 计数器递减}</script><span id="show"> </span>
网页中实现倒计时程序
原文地址:https://www.cnblogs.com/javallh/p/8436573.html