反复单击一个按钮 [英] Click a button repeatedly

查看:75
本文介绍了反复单击一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio2008.
我希望Java脚本代码每5秒重复单击一次按钮.

I am using visual studio 2008.
I want Java script code for clicking a button repeatedly for every 5 seconds.
Can any one please guide me on this!!!

推荐答案

您可以使用setTimeout("funct()",5000);

在哪个函数中是获取按钮对象并在其上调用btn.click()的函数.
You can use setTimeout("funct()", 5000);

where funct is the function that get your button object and calls btn.click() on it.


不是很明显:只有鼠标才真正单击控件吗?您真正需要的可能有所不同:您需要调用与单击处理程序相同的函数.这正是您可以做的.

您还可以使用计时事件.请参阅带有代码示例的文档:
http://www.w3schools.com/js/js_timing.asp [
Isn''t that obvious: only mouse really click on a control? What you really need is probably different: you need to call the same function which you would call from the click handler. This is exactly what you could do.

You can also use timing events. Please see the documentation with code samples:
http://www.w3schools.com/js/js_timing.asp[^].

—SA


这篇关于反复单击一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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