1
How do I get this script to run in 10 seconds ??
<script type = "text/javascript">
function simulateClick(x, y) {
var clickEvent = document.createEvent('MouseEvents');
clickEvent.initMouseEvent('click', true, true, window, 0, 0, 0, x, y, false, false, false, false, 0, null);
document.elementFromPoint(x, y).dispatchEvent(clickEvent);
}
simulateClick(1176, 435);
</script>
The idea would be to put a Countdown on it, someone knows ?
setTimeout(simulateClick(1176,435), 10000);
– Caio Felipe Pereira
@That would make him execute immediately, only the result (
undefined
) would be passed on tosetTimeout
. Better would besetTimeout(function() { simulateClick(1176,435); }, 10000);
– mgibsonbr
@mgibsonbr worked perfect, thanks
– a1b2c3d4
@mgibsonbr truth, what to write in a hurry. Write an answer there to earn internet points ;)
– Caio Felipe Pereira
@Caiofelipepereira Blz, I did it. And I still learned something new rsrs (I did not know that the
setTimeout
accepted additional arguments - in browsers recent at least)– mgibsonbr