[英]Autoclick 3 times over iframe on page load
I am using this iframe:我正在使用这个 iframe:
<iframe id="myframe1" src="https://777sportba.com/3c27348e623319abb826edabaeba4aee-live.html"></iframe>
I need a javascript code so when page load to trigger autoclick over the iframe 3 times.我需要一个 javascript 代码,以便在页面加载时触发自动点击 iframe 3 次。 Or other option when I click once over the iframe to simulate as it is clicked 3 times.
或者当我在 iframe 上单击一次以模拟单击 3 次时的其他选项。 Is one of the option possible to be done?
是否可以完成其中一种选择?
const clicked = () => { console.log("clicked") } const autoClick = async () => { const innerButton = await document.querySelector('#myframe1'); let click = new MouseEvent('click', { view: window, bubbles: true, cancelable: true }); for(let i = 0; i < 3; i++) { innerButton.dispatchEvent(click); } } autoClick();
<iframe id="myframe1" src="" onclick="clicked()"></iframe>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.