Solved

Links and Frames !!

Posted on 2000-03-17
10
271 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
2 CSS questions 11 36
Animate a Title 7 37
CSS measurement 10 18
Angular 2 complaining about map file 7 6
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now