Click to See Complete Forum and Search --> : click( ) syntax?


virgil
01-25-2003, 02:34 PM
Hi,

Just a, hopefully quick, javascript syntax question,
I thought this would be an easy one.

Im tring to get a submit button, to "auto click", so as 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. ( PHP and javascript are like apples and cinderblocks. )

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


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



<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...


<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>

still no good.....

Please pardon a newbe

Thanks again

Virgil

Charles
01-25-2003, 02:54 PM
The JavaScript method would use the onsubmit handler of the form to load the other page just before the form is submitted. But the JavaScript method is very bad. One or more in ten users do not use JavaScript and some of those people cannot use JavaScript because of their disabilities. And it's way easy to make this work all the time using PHP. Just have detailed_frame.php send a whole new frame set and set the target attribute to _top.

virgil
01-27-2003, 10:57 PM
Thanks Guys,

Sorry for the delay, Was out of town for the weekend...

Ok

Charles,

Ive tried everything I could think of to reload the frameset and use the _top target, but it won't work. My problem is I'm starting out in a different window. Let me explain... no, that will take too long, let me sum up....


Starting Frameset.php ( contains frame "Left" and frame "Right" )

Button in frame "Right" opens new "Details" Window ( window.open() )....

Hyperlink in "Details" Window will...

( A ) Load Frameset.php, in "Details" Window, w/frame "Left" and frame "Right". ( target=_top )

-OR-

( B ) Close "Details" Window ..via onClick=window.close()...
and reload frame "Left" ---OR--- frame "Right" in original frameset Window with frameset.php( loading both frames in one side or the other. )

target=right works ...
target=left works...
target=_top... will not work because it targets the window I'm closing. Is there a way to name the frameset window? It's the first starting broswer window....

I tried modifinng the URL
< a href='frameset.php?target=_top' target=left onclick=window.close( )>
But no luck

I've spent so much time tring to make it work, I figured I could just reload frame "right" w/a button click in frame "left" ( which is what I'm tring to spare the user from doing in the first place, to update the info in frame "right").

Follow?






Dave...



I thought someone might get a kick out of my OOP-lessness.

I'm using Compuserve ver.6.0 ( God , I hope that's what you meant! )


I tried...

document.details.details_button.click();

...again but alas no-go...

Is there a quick way to declare... document.details.details_button
... as an object?

like var= something




or do I have to learn this whole language to make click() work? Ive been 95% finished with this site for 200 hours now if you get my meaning. LOL IT JUST KEEPS GOING....over a year now...I've got to get this thing public...


Does all script have to be in the head tags or some other simple thing I just don't know? I thought the above code would work.


I tried to avoid javascript because I know I'm new, and it annoys me that everyother site seems to have JS error alerts.

But I've finally gotten it into my skull that PHP is serverside and can't do window manipulation (size etc. ) and for my site, I'm afraid that's a must.

Thanks again for your tolerence.

Virgil

:)

Charles
01-28-2003, 04:37 AM
Originally posted by virgil
Is there a way to name the frameset window? It's the first starting broswer window....<a href="frameset.php" onclick="window.opener.location = this.href; window.close(); return false">

khalidali63
01-28-2003, 08:24 AM
document.formName.buttonName.click()

works for both IE and Gecko 1.2 based browsers(NS7 / mozilla).

I'd say see how you are trying to initiate this event.

cheers

Khalid

virgil
01-29-2003, 08:02 PM
Hey Boys,

THANK YOU!!! :D :D :D

<a href="frameset.php" onclick="window.opener.location = this.href; window.close(); return false">


...didn't work because it targets only the "right" frame ....Which is the actual "opener".

But .....

self.name = "windowName";

Did the trick....:D

<a href="frameset.php" onclick="window.close()" target="windowName">


Reloads the frameset totally...




Never did get click() to work though...

Dave ...

I'm using ....Win 2000 NT --- IE 5.5


I can't for the life of me figure out why...


<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>


....doesn't work?



Does the script also have to be in the head section?
or after the form?

Is there anything missing from the above code?

i.e. var= something...?

or a declaration of the same ilk?


AGAIN...A MILLION THANKS

Virgil :D :D :D