homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Remove a Frame with Javascript?
Removing the top frame of a 2 frame page

 4:01 pm on Mar 8, 2003 (gmt 0)

I have a question...I have a page that is put together by an outside company (2). It is a list of company (1)'s products. The company (1) wants to have a top frame with their logo to remind people of that the list they are viewing belongs to them. The problem is that visitors can navigate from the list to the web and I want to give them the option of closing the top frame no matter what page the bottom frame has loaded. I only have html access to the top frame so the script would have to be in there. *The page is opened via JS.


<top frame> my page w/logo - html access
<bottom frame> our list on diff. server - no html access

So, can I have a piece of script that closes the top frame no matter what the bottom frame has loaded in it?




 5:52 pm on Mar 8, 2003 (gmt 0)

Sure you can ;)

<a href="javascript:top.location.href=bottom.location.href">Remove frame</a>

Replace "bottom" with the actual name of the frame :)


 9:18 pm on Mar 8, 2003 (gmt 0)

That is odd, I can't make it work (IE OSX). I have the script in the top frame, and the bottom frame's source is the remote file. Any ideas?


 10:40 pm on Mar 8, 2003 (gmt 0)


<a href="javascript:self.location.href=window.bottom.location.href">
Remove frame</a>


<a href="window.bottom.location.href" target=_top>
Remove frame</a>


 12:09 am on Mar 9, 2003 (gmt 0)

I must be having issues. What a day! I have no clue.


 12:32 am on Mar 10, 2003 (gmt 0)

Just to be sure, I don't need any script in the frameset, I can just put the script in the page that makes up the top frame, right? God I hate frames.


 5:16 am on Mar 10, 2003 (gmt 0)

Right, you just put the script in the top frame.

However, the advice you're being given assumes that you have assigned name="bottom" to the bottom frame. You should replace "bottom" with whatever name you have actually assigned to the bottom frame...and you assign that name attribute in the frameset document.

Also note that "top" does not refer to the name of the top frame, so you do not change that. "Top" is a dedicated javascript word for the top level window - the parent of all contained frames.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved