如何暂停网站上的计时器 [英] How to pause the timer available in website

查看:521
本文介绍了如何暂停网站上的计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为个人练习目的编写不同的免费MCQ在线测试的多项选择题。但由于其中有计时器,我无法写出问题和答案。



在vb.net中,在webbrowser控件的帮助下,我想打开网站。

我想放两个按钮暂停继续如果我点击暂停定时器应该暂停。如果我点击继续,计时器应该继续下一个问题



但是怎么做?



感谢任何帮助



我尝试过:



我尝试了

I am trying to write the Multiple Choice Questions of different free MCQ Online Tests for personal practice purposes. But I am not able to write the questions and answers because of the timer available in it.

In vb.net with the help of the webbrowser control i want to open the sites.
I want to put two buttons Pause and continue if i click on pause the timer should be paused. and if i click on continue the timer should continue to next questions

But How to do it?

Any help is appreciated

What I have tried:

I tried with

Threading.Thread.Sleep(10000)



但保留了形式好像被绞死了。它不允许任何互动



请帮助


but it keeps the form as if it is hanged. it does not allow any interaction

please help

推荐答案

你正在暂停winform的主线程用那个代码。这意味着您的应用程序基本上所有处理都会停止。

请注意,您提到了计时器,但是您正在暂停_thread_。因为你提到了webbrowser控件,我假设你在那里展示了一些你可以控制的内容。

在这种情况下你会想要使用JavaScript(是的!)并使用setTimeout()或者的setInterval()。查看: JavaScript时间事件 [ ^ ]
You are pausing the main thread of your winform with that code. That means that basically all processing stops for your app.
Notice that you mentioned timer, but you are pausing the _thread_. Because you mentioned the webbrowser control I'm assuming you are showing some content in there that you have control over.
In that case you will want to use JavaScript (yeah!) and use setTimeout() or setInterval(). Check out : JavaScript Timing Events[^]


这篇关于如何暂停网站上的计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆