Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Links and Frames !!

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
Gareth_Hastings
Asked:
Gareth_Hastings
  • 4
  • 2
  • 2
  • +2
1 Solution
 
mblaseCommented:
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
 
jbirkCommented:
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
 
jbirkCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Gareth_HastingsAuthor Commented:
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
 
mblaseCommented:
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
 
jbirkCommented:
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
 
AdiFCommented:
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
 
robjgreenCommented:
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
 
jbirkCommented:
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
 
robjgreenCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now