开发者

How to click a browser button with JavaScript automatically?

开发者 https://www.devze.com 2023-02-01 02:25 出处:网络
How to click a b开发者_如何转开发utton every second using JavaScript?setInterval(function () {document.getElementById(\"myButtonId\").click();}, 1000);

How to click a b开发者_如何转开发utton every second using JavaScript?


setInterval(function () {document.getElementById("myButtonId").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);


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>

`

0

精彩评论

暂无评论...
验证码 换一张
取 消