PDA

View Full Version : Using Menu Bottons with Frames


Diamax
11-18-2002, 11:29 AM
Hello guys I have a question, if you don't mind.

I'm using buttons for the menu in my page, that is using frames.
I know how to make links and make them point to the main frame from the menu, but looks like for buttons to point to the main frame is different.
Could you guys tell me how to make a button open a link to a certain frame PLEASE, because I cannot get that working.
The button looks like this:

<FORM>
<input type="button" value="Go Here" style="BACKGROUND-COLOR: black;
COLOR: white; FONT-FAMILY: arial; FONT-SIZE: medium;
HEIGHT: 28px; WIDTH: 95px"
onmouseover="this.value='OK', this.style.background='black';"
onmouseout="this.value='Go Here',this.style.background='black';"
onClick="self.location='http://www.google.com'">
</FORM>

Thank You Guys!!

kdjoergensen
11-19-2002, 01:13 PM
You are so close ...

onClick="top.frameName.location='http://www.google.com'">

If you have problems with 'top' then try 'parent'

onClick="parent.frameName.location='http://www.google.com'">


If you still have problems, let us see your frameset. Sometimes it requires a bit 'crawling' up and down the frameset to reach the correct frame. This if you have a lot of nested frames.

The below is not part of my reply to your question, but an explanation on how to travel deeply nested framesets in general. Read it if you are interested, or just forget about it..:D

What you in essence is doing is to provide a roadmap to the browser of how it should go to reach the correct frame.

In below example I am 'crawling' from the 'here' frame to the 'there' frame, e.g. I am opening a page in the 'there' frame from a link the 'here' frame:

<frameset rows="50%,50%">

<frameset cols="10%,90%">
<frame name="there">
<frame>
</frameset>

<frameset cosl="50%,50%">
<frame name="here">
<frame>
</frameset>

</frameset>

onclick="top.frames[0].there.location='...."

E.g. go to the top (first frameset which exsits) and pick the first 'frame' in this frameset. In this case the first (index number zero: 0) 'frame' happens to be a frameset not a frame as such. From this 'frame' to to the frame named 'there'.

As you can see I could not have said: top.there.location because 'there' is not a frame accessible under the top (outmost) frameset. it is inside frames[0]

I could not have said: parent.there.location, because the parent frame for 'here' (the frameset which holds the frame here) is not the parent for 'there'.

Both of these would have worked:
top.frames[0].there.location
top.frames[0].frames[0].location
parent.parent.frames[0].there.location

Diamax
11-22-2002, 07:59 AM
Thank You Kdjoergensen !!

I got it working... after I posted the thread I went on internet and looked for more info, and finally found something on that.
However all the infos and examples you posted in this thread are very welcome... and I'm saving the page for future reference.

Thanx A Lot Again!!!