本文介绍了setInterval停止警报工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个MCQ测验,每个问题都有一段时间.我还在脚本中使用了onbeforeunload,以防止用户意外离开测验页面.但是当显示警报时,我的setInterval计数器停止工作.即使有警报,我如何使倒数计时不停止?
I am creating a MCQs quiz and there is a time for each question. I have also used onbeforeunload in my script to prevent the user from accidentally navigating away from the quiz page. But when that alert gets display my setInterval counter stop working. How can i make the countdown to not stop even if there is an alert?
在这里进一步解释我的问题的是 FIDDLE
To further explain my problem here is the FIDDLE
推荐答案浏览器对话框被阻止.打开它们时,所有脚本执行都会停止.您无法更改此行为.
Browser dialogs are blocking. All script execution stops when they are open. You cannot change this behaviour.
更多推荐
setInterval停止警报工作
发布评论