Solved

Links and Frames !!

Posted on 2000-03-17
10
272 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

895 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

12 Experts available now in Live!

Get 1:1 Help Now