当前位置:网站首页>JS timer realizes the countdown and jumps to the login page

JS timer realizes the countdown and jumps to the login page

2022-07-26 13:51:00 Teenagers

count down 3 Seconds jump to the page login

if (res == " Registered successfully ") {
    
    var wait = 3;
    setInterval(function refer() {
    
        if (wait > 0) {
    
            document.getElementById("resTxt").innerHTML = res +wait+" Jump to the login page in seconds ";
            wait--
        } else {
    
            ......
        }
    }, 1000)

Add

clearInterval() Method to stop setInterval() Function code executed by method .

var test = setInterval("javascript function",milliseconds);
clearInterval(test) 
原网站

版权声明
本文为[Teenagers]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/201/202207181743130184.html