Welcome to WebmasterWorld Guest from 54.196.233.239

Forum Moderators: open

Message Too Old, No Replies

Remove a Frame with Javascript?

Removing the top frame of a 2 frame page

     

Bluetuna

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

10+ Year Member



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.

Ex:

<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?

Thanks!

DrDoc

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

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Sure you can ;)

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

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

Bluetuna

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

10+ Year Member



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?

HocusPocus

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

10+ Year Member



Try:

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

or

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

Bluetuna

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

10+ Year Member



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

Bluetuna

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

10+ Year Member



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.

tedster

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

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month