setInterval倒计时10s
if (condition == 1) { var ii = 10; alert_s("尊敬的用户:", "您好,我们已对该项目进行了服务升级,<span id='count_down'>10</span>s后自动跳转。"); var cd = setInterval(function(){ ii--; $("#count_down").html(ii); if (ii == 0) { clearInterval(cd); window.location="https://www.baidu.com"; } }, 1000); }
alert_s为自定义弹框
condition为满足的条件