Page 1 of 1

click() syntax?

Posted: Sat Jan 25, 2003 12:10 pm
by virgil
Hi, :)

Just a hopefully quick javascript syntax question,

Im tring to get a submit button, to "auto click", to reload another frame, upon loading of the first frame.



Im just a JS cut and paster ( still learning ) and not sure of the syntax.


I get an "document.details.submit" is null or not an object" error.

I thought naming the form would declare the object, but I must be mistaken.

I would be most grateful for any help, if its not too much trouble.


So much to learn... so little time....

Code: Select all

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

document.details.submit.click();

 //--> </SCRIPT>

<form NAME='details' method='get' action='detailed_frame.php' target='right'>
 <input type='submit' value='More Details...'>
</form>
I also tried...

Code: Select all

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

document.details.details_button.click();

 //--> </SCRIPT>

<form NAME='details' method='get' action='detailed_frame.php' target='right'>
 <input type='submit' NAME='details_button' value='More Details...'>
</form>

Thanks again

Virgil :)

Posted: Tue Jan 28, 2003 2:18 am
by DaZZleD
first of all, the order is wrong... even if you were writing the correct syntax, the javascript part runs before the form is initialised. second of all you submit a form, not a button so you should use document.all.form_name.submit().

your code should look something like:

Code: Select all

<form NAME='details' method='get' action='detailed_frame.php' target='right'> 
<input type='submit' value='More Details...'> 
</form>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> 
<!-- 

document.all.details.submit(); 

//--> </SCRIPT>
what is exactly that you want to do?