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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to kill 3 frames which are contained within another

Status
Not open for further replies.

celia05es

Programmer
Jan 10, 2002
81
0
0
US
Hello,

I have an application that is contained inside a frameset: One horizontal frame contains the logo and the application title.
The application is contained within the 2nd frame.

Code:
<HTML>
<FRAMESET Rows="110,*" BORDER=0>
 <FRAME Name="head" SRC="includes/logo.html" SCROLLING=no MARGINHEIGHT= 0>
 <FRAME Name="panel" SRC="login.jsp" SCROLLING=auto MARGINHEIGHT=0>
</FRAMESET>
</HTML>

The whole application is contained within the 2nd horizontal frame: "panel".

In each page there is a kind of menu, made of links, that allows the user to go backward... Everything works fine until in one of my page I need to use 3 frames (1 horizontal and 2 vertical frames.

THey are defined as follows;
Code:
<frameset rows="20%,80%" >
<frame src="horizontal.jsp" scrolling=no>
  <frameset cols="20%,80%" >
    <frame src="toc.jsp" name="frame1">
    <frame src="globalParameters.jsp" name="frame2">
  </frameset>
</frameset>

My problem is .....
- When the user on a link to go backward, I would like the 3 frames to desappear.
Now, I have tried to place the below line in javascript in the head section of the page:

Code:
<script>
if (self.location != top.location) top.location = self.location;
</script>

but it makes the whole frames disappear!!! and always want the 2 initial frames to remain!!!

Help me please!
ELisabeth
 
Rather than having those frames you want to be able to get rid of part of the main page, make them their own frame page so that your main page just has the frames you always keep and a single frame to encompass the rest. Make a frame page that loads into that one frame and itself has the additional frames. Then when you want to get rid of those application frames you just change the page source for that frame.


At my age I still learn something new every day, but I forget two others.
 
I am not that good with frames.... so would you be so kind to explain a little bit more (may be with an example) what you mean?. I don't really see where I could make the changes.
THanks
 
I do not work with frames myself and I am just guessing as to what might work.

Say that you have three frames.

Frame1: Header on the page

Frame2: Content window
<This content has it's own frames defined>

Frame3: Footer on the page

If you want to get rid of everything in the content window but not lose the header and footer frames then you change the location for Frame2, not for the entire page.

Look at the link below to see an example of changing the source for individual frames.

At my age I still learn something new every day, but I forget two others.
 
NO, this is not completely correct.
I have:
Frame 1 : Header
Frame 2 : Content window.

Most of the time this is what I have but at one point I might have:
Frame 2: Frame 21 => horizontal frame
Frame 22 => Vertical frame
Frame 23 => Vertical frame
That is that frame 2 contains 3 frames !
Now, when I click on any link on frame21 (that will make the use go back)=> I need Frame 21, frame22 and frame 23 to disappear!


Anyway, I had a look at the link you sent me..unfortunately I am not that good with frames so it is not very clear to me!

 
My example was not meant to represent your situation exactly. It's the idea that is important.
In your case it is just a matter of changing the source for the one frame. Using top.location is changing the source for the entire page, not just that frame.
Try using something like this.location.href = "yourlink.com" inside of that frame.

At my age I still learn something new every day, but I forget two others.
 
I am sorry to bother you but I don't understand a lot.. you see my knowledge of Javascript is not great so I might have some basis missing here but unfortunately I don't have a lot of time.... could you please help me more?

I always want to have two frames.
At one point, from the contents frame, I call config.jsp

Code:
<frameset rows="20%,80%" >
<frame src="horizontal.jsp" scrolling=no>
  <frameset cols="20%,80%" >
    <frame src="toc.jsp" name="frame1">
    <frame src="globalParameters.jsp" name="frame2">
  </frameset>
</frameset>

horizontal.jsp is made of links that go back.
Now, when I click on one of those links, let's say link1, I would like the 3 new created frames to go away and the page to be loaded within the content frame.
COuld you please tell me how to achieve it?

Many thanks

 
I assume you do not have the ability to modify the links generated by the globalParameters.jsp page?

If you have no control over the links in that page then you do not have a way to grab control of the click event so you can break out of the frame page.
It's a problem when you are dealing with frames inside of frames especially when some of the content is not under your control.


At my age I still learn something new every day, but I forget two others.
 
THanks to you I have solved my problem. THank you very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top