js_倒计时去执行函数或则跳转页面

时间:2022-12-01 22:01:03

js_倒计时去执行函数或则跳转页面:

var wait = 5; $(document).ready(function () { returnPage(); }); function returnPage() { if (wait == 0) { var redirectUrl=$("#redirectUrlHidden").val(); window.location.href=Global_Sever_url+redirectUrl; } else { var msgId=$("#msgId").val(); $("#redirectUrlBtn").html(msgId+"   "+wait + "秒后自动跳转!"); wait--; setTimeout(function () { returnPage(); }, 1000) } }