Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1 link 2 frames

Status
Not open for further replies.

sampei

Technical User
Apr 3, 2001
4
IT
Hello.
I created an homepage with 3 frames:topFrame,topFrame1 and mainFrame.
In topFrame1 I have a button.gif.
Can I change the content in topFrame1 and in mainFrame when I click it?
I appreciate any help here! Thanks!

Max Sampei
 
Here is a technique that many people use to do just that. I have not used it personally. Let me know if it works ok.

I found this at the following address:



There are two basic techniques for updating multiple frames with a single link: The HTML-based technique links to a new frameset document that specifies the new combination of frames. The JavaScript-based solution uses the onClick attribute of the link to update the additional frame (or frames).

The HTML-based technique can link to a new frameset document with TARGET="_top" (replacing the entire frameset), but there is an alternative if the frames to be updated are part of a nested frameset. In the initial frameset document, use a secondary frameset document to define the nested frameset. For example:

<FRAMESET COLS=&quot;*,3*&quot;>



<FRAME SRC=&quot;contents.html&quot; NAME=&quot;Contents&quot;>



<FRAME SRC=&quot;frameset2.html&quot; NAME=&quot;Display&quot;>



</FRAMESET>
A link can now use TARGET=&quot;Display&quot; to replace simultaneously all the frames defined by frameset2.html.

The JavaScript-based solution uses the onClick attribute of the link to perform the secondary update. For example:

<A HREF=&quot;URL1&quot; TARGET=Frame1



onClick=&quot;top.Frame2.location='URL2';&quot;>Update frames</A>
The link will update Frame1 with URL1 normally. If the reader's browser supports JavaScript (and has it enabled), then Frame2 will also be updated (with URL2).
Ya' Gotta Love It!:)X-)
 
Thank you TulsaJeff.
I used your JavaScript based solution and it`works.

Now I have a problem with back button of IE.
I click my button.gif and I change the content in two frames.To return to my home clicking the back button I have to press it 2 times.
A first time to restore the topFrame1.
A second time to restore the mainFrame.

What`s the problem?

Thank you for your reply.

Sampei
 
why not use a link?

javascript:history.go(-2) Ya' Gotta Love It!:)X-)
 
Thank you TulsaJeff.
Sorry but I`m a beginner in JavaScript
Can u show me where should be placed this link code?
I apologize with you.
Thanks again

Sampei
 
just place the code in the properties panel just as if it was a normal link.

You can even copy and paste it in.

Make some text that says &quot;go back&quot; or whatever you want it to say... highlight the text and paste the code in the link area of the properties panel.

hit F12 to test the page in a browser. Ya' Gotta Love It!:)X-)
 
Sorry but it doesn`t work

1)I made a text `GO BACK` in the updated page in mainFrame.
2)I highlighted the text and I linked it with your code.

Result:

1)I click on button.gif and I change content in topFrame1 and in mainFrame.In my new page (in mainFrame) there is the text &quot;GO BACK&quot;.I click it to return in my first homepage but it doesn`t work.

ABOUT BROSWER (Explorer)

Back button (broswer bar)update one frame.
Two clicks to return to my homepage.

Thanks
 
Sorry...I wasn't sure if that was netscape only or if it would actually work in IE.

javascript:history.back() ... I do not know if you can put -2 between the perenthesis like in netscape or not is the IE script of choice I beleive. I am not the javascript guru actually. I use a little bit but with lots of trial and error.

You might try posting in the javascript forum also and see if you get any hits. Them guys are pretty good I hear. Ya' Gotta Love It!:)X-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top