Jquery 实现倒计时跳转到指定页面或关闭窗口
项目中需要增加一个投票功能,投票完成后自动倒计时 10 秒跳转到首页。
JavaScript 代码:
// 设置超时时间为 10 秒钟
var timeout = 10;
function show() {
var showbox = $(".showbox");
showbox.html(timeout);
timeout--;
if (timeout == 0) {
window.opener = null;
window.location.href = "index.aspx";
}
else {
setTimeout("show()", 1000);
}
}
源代码:下载

浙公网安备 33010602011771号