How to click a browser button with JavaScript automatically?

与世无争的帅哥 提交于 2019-11-27 11:53:21
John Hartsock
setInterval(function () {document.getElementById("btnMakePaperclip").click();}, 1000);

This will give you some control over the clicking, and looks tidy

<script>
var timeOut = 0;
function onClick(but)
{
    //code
    clearTimeout(timeOut);
    timeOut = setTimeout(function (){onClick(but)},1000);
}
</script>
<button onclick="onClick(this)">Start clicking</button>
document.getElementById('youridhere').click()

This would work

setInterval(function(){$("#myButtonId").click();}, 1000);
Footer

You can use

setInterval(function(){ 
    document.getElementById("yourbutton").click();
}, 1000);

this will work ,simple and easy

 `<form method="POST">
<input  type="submit" onclick="myFunction()" class="save" value="send" name="send" id="send" style="width:20%;">
</form>
<script language ="javascript" >
function myFunction() {
setInterval(function() {document.getElementById("send").click();}, 10000);    
}
</script>

`

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!