View Full Version : how do I get 2 different targets/frames with the same one CLICK...?

05-28-2007, 08:26 AM
Hi guys, Im new to this, though Ive been designing for my own hobbie...Im working on my personal website and I have a particular problem I hope someone could help me with...PLEAAAASE lol.

Im trying to figure out how is it that I can click on one image (which acts as a link in my header menu) and change the WHOLE page over...
Im using 2 Iframes: 1 IFRAME for is my HEADER, and another one for my MAIN FRAME (which will have the content once something is clicked on).

Now I cant figure out how I can click, for example:
"BIO" and have the header frame change withing itslef (because I designed something else and everything in that iframe thats a button is a ROLLOVER image) BUT ALSO AT THE SAME TIME AS IT CHANGES ITSELF, Open a frame within my MAIN FRAME fo that it can give the CONTENT of the BIO...???

Is this a little too complicated to explain? I cant find the info anywhere and my dreamweaver is just too confusing since I dont know the first thing about Java...

I just want to open a new header and a new main frame by clicking on link...so that it's not a boring site...lol

here's an example without actual "coding" for the links...



Wiz Kilo

05-28-2007, 08:35 AM
Well, you can't do this with just html, since that only allows a single action per link.

I think it might be as simple as--
<a target="headerframename" href="next.htm" onClick="mainframename.location = 'next2.htm';">
(if that works for you)

Hmm... I wonder if it would work to just place one link within another.

<a href="1.htm" target="1"><a href="2.htm" target="2">click</a></a>
No clue without a good bit of testing. Certainly not standard.

05-28-2007, 08:25 PM
I tried that, it sounded like it would be logical...but it didn't work...

What do I do?

its driving me absolutely bonkers!

Wiz Kilo

05-28-2007, 08:29 PM
Maybe someone else will have an idea. I thought the javascript code would work, but maybe there's something about it that can be fixed. I'm not sure.

05-28-2007, 08:33 PM
Assuming you have frames with these names this should work:

<a target="headerframename" href="next.htm" onclick="top.mainframename.location = 'next2.htm';return true;">

But, it's important where the page with this on it is and where the mainframename is in relation to it, if it is on the top frameset, that should do it.

05-29-2007, 02:50 AM
hey guys, thanx so much for the help...I actually found this in another thread, that had a link for this Java Script Tutorial...and finally after many hours of searching and trying and trying and trying some more, I found this code that works...

<A HREF="/newsite/bio/wkheaderbio.html" TARGET="header" onClick="parent.mainframe.location='/newsite/bio/wkbio.html'">

I needed to put the "parent.mainframe.location='...'" part for it to work properly!

once again thank you...

now Im having a CSS Vertical Menu problem that I wrote another thread on...if u guys know anything about it, please check it out maybe ya'll know something that could help me figure THAT problem out, lol...(Java Scripting is a B***! it's HARD)

Wiz Kilo

05-29-2007, 03:06 AM
top, rather than parent, may be a good idea, in that depending on the setup (though yours fits parent at the moment), top may be more versatile.
top jumps to the uppermost frame, then to the frame you've specified. parent just goes up one. top would work from within two layers, such as from within an iframe in one of your frames.
However, now, it isn't relevant. Just something to remember for later if it comes up.

05-29-2007, 03:52 AM
Using return true for the onclick event is also a good idea, as it ensures that the link itself will also fire. Having no return value leaves it up to the vagaries of the browsers, which differ.

Using top or parent is really a matter of which is most appropriate for the situation. Top is the topmost page, parent is the page immediately above the page with the code on it. Often these are both the same page. Often they are different. The overall design of the frameset and it pages determines which is best for you. In extreme cases (where the nesting level could vary on the site with there even, at times, being another page on top beyond the desired frameset and the possibility - not the certainty - of intervening framesets), tests and/or loops might be required to find the actual parent page desired.

It doesn't sound like this is a factor here. If parent is working for you, go for it.