I've tried to develop a simple Greasemonkey script in javascript. How can I automatically simulate a click on specific button with an interval between each click?
Here's my code:
var Next=document.getElementsByClassName("SubmitButton");
for (var i=0, c = Next.length; i<c; i++)
{
Next[i].click();
setTimeout('Next[i].click()',3000);
}
The problem is that the code only clicks on the first value of Next. Why?
本文介绍了一种使用JavaScript实现定时自动点击页面上特定按钮的方法。通过改进的代码示例,解决了仅对首个元素生效的问题,并确保了按设定间隔依次触发所有目标按钮。
1万+

被折叠的 条评论
为什么被折叠?



