Solved

Links and Frames !!

Posted on 2000-03-17
10
279 Views
Last Modified: 2010-04-09
Ok, I have 5 frames on my site (http://www.ghnet.demon.co.uk) 1 at the top, bottom, left, right and middle.

The Top frame is only used for the title.

The Right frame is not in use yet.

The Middle frame is where all the stuff is displayed.

The right frame has an index in it.

What I would like to do it make it so when someone clicks a link on the left frame it changes BOTH the bottom frame and the MIDDLE frame. At the moment it only changes the middle frame.

If you go to my site you'll see what I mean. When you click on the pictures link the BOTTOM frame changes then you need to click a link on the BOTTOM frame to change the MIDDLE frame. But then if you go to another link on the LEFT frame, it will change the MIDDLE frame but the BOTTOM frame still has the same page in it.

Anyway, I'd be glad for some help. Cheers

Gareth
0
Comment
Question by:Gareth_Hastings
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 2

Expert Comment

by:mblase
ID: 2629494
The best way to do this is to reorganize your nested framesets. Something like this:

<frameset rows="100,*">
  <frame src="top.html">
  <frameset cols="50,*,50">
    <frame src="left.html">
    <frame src="middle_bottom.html">
    <frame src="right.html">
  </frameset>
</frameset>

....and then create another framed document at "middle_bottom.html" that contains two frames, the middle and the bottom. Now you can assign a name to the "middle_bottom" frame and TARGET hyperlinks to it.

If you don't want to do that, which you probably don't, then a JavaScript solution exists. In the <BODY> tag of your Quake, jokes, etc. pages, place this attribute (or something similar):

onLoad="parent.frames[4].location='bottom.htm'"

This should reload bottom.htm into the last frame (the bottom one) whenever that page is completely loaded into the browser.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2629804
Also you can change your links themselves to change two frames at once...  It looks like this (just an example):
<A HREF="JavaScript:;" onClick="parent.bottom.location='bottom.htm'; parent.middle.location='middle.htm'; return false;">Click here to change two frames</A>


-Josh
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2629827
Oh, that was obviously also javascript.  Here is a description of what's going on in that script:

<A HREF="JavaScript:;"
This ensures that nothing changes in the current frame when the link is clicked even if javascript is turned off...

onClick="parent.bottom.location='bottom.htm';

first the bottom frame is changed.  Modify parent.bottom to signify the name of the bottom frame in the frameset.  You can also use an array as mblase did (parent.frame[4]), in that case the number is the number of the frame counting top to bottom on the frameset page starting at 0...  You also need to modify the url of course...  it's between single quotes so as not to confuse the parser (double quotes will mess it up unless you escape them).

parent.middle.location='middle.htm';

The middle frame of course... same as previous.

return false;"

Return false is needed to ensure the browser doesn't even get to the href part of the link...  This way no change is made to the links frame.

-Josh
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Gareth_Hastings
ID: 2629836
I've just thought of something, I use applets to change the links. So I don't think I can do it like that. Is there a way of doing it when either a page loads or is closed. I know you use onLoad but I'm not sure how !??!?!
0
 
LVL 2

Expert Comment

by:mblase
ID: 2629870
onLoad simply fires some JavaScript whenever a web page is completely loaded (inline-images and all). You put it in the <BODY> tag whenever you need it. Any JavaScript you like can be used with it; just watch out how you next your "double quotes" and your 'single quotes'.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2629871
mblase's solution ideas included an onload...

Just add the onload to the body tag to one of the two pages to be loaded, and open that page normally with your applet.  It will then launch the other page once it's loaded...

You could also put it at the top of the page so it happens right away instead of onload... like this:

<SCRIPT language="JavaScript">
<!--
parent.bottom.location="bottom.htm";
-->
</SCRIPT>

just add that to the header of the middle page...

-Josh
0
 
LVL 2

Expert Comment

by:AdiF
ID: 2630762
Umm... I'm not sure, but try adding another <PARAM> tag, so the first one would have an additional one called:

<param name="url" valuetype="ref" value="picture_page.htm" target="bottom">

It just might load the page in both the middle and bottom frames.
0
 

Accepted Solution

by:
robjgreen earned 200 total points
ID: 2639900
Hi Gareth...

Try this script:

<script language="JavaScript">
<!--

   function go() {
      parent.frame1name.location.href="url1.html";
      parent.frame2name.location.href="url2.html";
   }

// -->
</script>

Then use the following in your link:

<a href="JavaScript:go()">Link</a>


Hope this is of some help.. if you need an explanation let me know.


Kind Regards,

Rob.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2640055
robjgreen, did you read the whole question?  He already said he couldn't use that method, which was the first thing I suggested (in a shorter form).  He's using an applet, not an html link...

Though that reminds me, Gareth, can you modify your applets?  If so, prehaps you can set them up to call a javascript function to change both urls or even have the java applet change both frames.

-Josh
0
 

Expert Comment

by:robjgreen
ID: 2640110
I'm not really experienced with Java but I thought you could call JavaScript from within an applet?

Without seeing the page and how the applets work how are we supposed to help?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need HTML output in powershell line by line 3 37
output of netstat -r in Powersshell HTML 3 48
Asp response.write to clients 6 34
Can't get cursor to change 3 16
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question