setInterval停止警报工作

编程入门 行业动态 更新时间:2024-10-23 21:30:06
本文介绍了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停止警报工作

本文发布于:2023-11-27 03:56:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636478.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   工作   setInterval

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!