简体   繁体   English

自动单击按钮脚本以防篡改?

[英]Auto click button script for tampermonkey?

am trying to create a user script which would click the following button as soon as possible on loadiing the page. 我正在尝试创建一个用户脚本,该脚本将在加载页面时尽快单击以下按钮。

<button class="btn" tabindex="10" disabled="disabled" onclick="ValidateAndSubmit('1')" title="" pay-tab="1">Do now</*button>

please help as i am trying from long time but failing to do so. 请帮忙,因为我正在尝试很长一段时间,但是没有这样做。

i tried this: 我尝试了这个:

<script type="text/javascript"> 
setTimeout(function()
 { document.getElementById("btn").click(); },1000); 
</script>

Try this 尝试这个

(function() {
    window.addEventListener('load', ValidateAndSubmit('1'), false);
})();

(function() {})() defines a scope that is self executed without waiting for any events. (function() {})()定义了一个无需等待任何事件即可自行执行的作用域。

window.addEventListener('load', ValidateAndSubmit('1'), false); subscribes the function ValidateAndSubmit to window load event so that the function is executed on load. ValidateAndSubmit函数预订给window load事件,以便在加载时执行该函数。 This is the same function you are trying to execute by clicking the button. 这与您尝试通过单击按钮执行的功能相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM