Weborum Webmaster Forum > Automatically Click A Link
Help - Search - Members - Calendar
Full Version: Automatically Click A Link
Weborum Webmaster Forum > Web Page Design > Javascript
Joe
Hey guys,

Not being a JS man I'm not sure if this is possible or not, but can JavaScript automatically click a link after a specified amount of time has passed?

Say like, after 10 seconds it clicks the link which already has a JS function assigned to it which opens a pop-up ... or would it be easier to just run the script after 10 seconds?

Cheers
Joe
Actually, it seems it isn't possible. Using the setTimeout function it just blocked the pop-up automatically.
WolfShade
QUOTE(joe2kiss @ Apr 5 2005, 05:21 AM) [snapback]25979[/snapback]

Actually, it seems it isn't possible. Using the setTimeout function it just blocked the pop-up automatically.


I know, I know, it's an old post.. but I have it if anyone wants it.

CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script language="javascript">
<!-- hide from non js browsers
function autoClick() {
     document.getElementById('thisLink').click();
    }
// -->
</script>
</head>
<body ######="setTimeout('autoClick();',3000);"><!-- three seconds, increase as you like -->
<a href="apage.html" id="thisLink" name="thisLink" target="newWindow">Click Here</a>
</body>
</html>

:(:(:( For some reason, ###### has replaced on+Load. Other than that, it works.

WolfShade
^_^
Willy Duitt
Try using the click event handler...

EDIT: Oh, I now see that is what WolfShade's script is using... blush.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.