Forum Moderators: open

Message Too Old, No Replies

Removing the Top Frame

How do I remove the top frame?

         

leo03714

6:39 pm on Apr 13, 2004 (gmt 0)

10+ Year Member



When I link to another website I put the link in frames, the bottom frame is the website and the top frame says, return to my site and I close this frame but how do I close that frame?

What I want to do is have a script that looks at the location of the bottom frame and makes the whole page go that frame.

Can anyone help?
Leo Kent

ajkimoto

7:58 pm on Apr 13, 2004 (gmt 0)

10+ Year Member



Leo,

First of all: Welcome to Webmaster World!

As for your question, here is one possible solution. This example assumes that you have a frameset html document and a separate html document that lives in the top frame of the frameset html document.

The top frame (topframe.htm) source:

<head>
<title>top frame source</title>
<script type="text/javascript">
<!--

//this function should be located in head of the html page which lives in the top frame.
//You will also need to give the bottom frame of your frameset html document an id (in this example I called the bottom frame bottomFrame
function closeFrames(){
//get source of bottomFrame from the parent frameset html document
var cURL=parent.document.getElementById('bottomFrame').src
//set the location of the parent window to cURL
parent.location=cURL
}

//-->
</head>

<body>
<button onclick="closeFrames()">close frame</button>
</body>

the frameset source from the frameset html page:

<frameset framespacing="0" border="true" frameborder="0" rows="50,*">
<frame name="topframe" scrolling="auto" target="_self" noresize src="topframe.htm" marginwidth="12" marginheight="16">
<frame id="bottomFrame" name="bottomFrame" scrolling="auto" target="_self" noresize src="http://yourbottomurlhere" marginwidth="12" marginheight="16" >
</frameset>

Hope this helps,

ajkimoto

leo03714

8:42 am on Apr 14, 2004 (gmt 0)

10+ Year Member



Thanks very much ;)