Click to See Complete Forum and Search --> : simulating buttons clicks.


oneeyedziggy
07-11-2004, 01:43 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function clickMe(){
document.getElementById('blah').click();
}
function clickMe2(){
setTimeout("document.getElementById('blah').click();",15000);
}
//-->
</script>
</head>
<body onload="clickMe2()">
<a href="#" id="blah" onclick="alert('You clicked me!');">Link1: click me for an alert</a><br>
<a href="#" onclick="clickMe();">Link2: click me to simulate click on Link1 or wait 15 seconds from page load</a><br>
</body>
</html>

i recieved the above help earlier which worked for a portion of my project, but i need to be able to simulate a click a button in a frame, which doesn't have an id to refer to.

if sub.html is

<html>
<form>
<input type=submit value=submit>
</form>
</html>


and Main.html is

<html>
<center>
<body onLoad="">
<iframe src="C:\windows\desktop\sub.html" height="200" width="300"></iframe>
</center>
</body>
</html>


then what code can i add to the onLoad="" in Main.html to simulate a click on the submit button in sub.html without editing the code of sub.html?