Assistance with javascript -
can please me javascript code...
<script type="text/javascript"> addeventlistener("load", function() { function callback(){ settimeout(showit, (parseint(math.random()*(60000 - 10000)) + 10000));} document.body.click(); }); </script>
i tried make wait page load, wait random amount of time, , click anywhere in body... how can make work??
your onload function defines function called callback
. doesn't ever call it, nothing inside happen.
get rid of function , put code directly in event handler function instead.
addeventlistener("load", function() { settimeout(showit, 500); //simplified timer document.body.click(); }); function showit() { alert(1); } document.body.addeventlistener("click", function() { alert('clicked'); });
as aside:
(parseint(math.random()*(60000 - 10000)) + 10000))
don't use parseint without radix! might have number starting 0
won't treated decimal.
you can to:
settimeout(showit, ((math.random() * 5) + 1) * 10000);
Comments
Post a Comment