click() syntax?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
virgil
Forum Commoner
Posts: 59
Joined: Thu Jun 13, 2002 11:43 pm
Location: New York, U.S.

click() syntax?

Post 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 :)
User avatar
DaZZleD
Forum Commoner
Posts: 38
Joined: Tue Jan 07, 2003 5:39 am

Post 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?
Post Reply