Close frame or open frame to whole window
Moderator: General Moderators
Close frame or open frame to whole window
I searched around and didn't find an answer for this. Basically I want a link in Frame A that when clicked either gets rid of Frame A or opens Frame B into the window. Thanks.
The problem is that I dont know exactly what the link is. Basically my site will be in the top frame and an external site will be in the bottom frame. So I want a way for the user to close the top frame and just have the external site. Initially I know the address of the external site, but the user may surf around and I dont want to reset them to the beginning.
maybe not exactly what you want, but you might minimize the frame
and top.html
Code: Select all
<html>
<frameset rows="20%,*" id="idFrameset">
<frame src="top.html" />
<frame src="bottom.html" />
</frameset>
</html>Code: Select all
<html>
<head><title>changing framesize</title>
<script type="text/javascript">
function minimizeFrame()
{
w = window.parent.document.getElementById("idFrameset");
if (w != null)
w.rows="0,*";
}
</script>
</head>
<body>
<button onClick="javascript:minimizeFrame()">minimize</button>
</body>
</html>Here ya go!
Should work!
c.collins
Code: Select all
<a href=# onClick="Javascript:top.location.href=top.content.location.href;" >Break out of frames</a>c.collins
Insert this into your top frame, and attach it to a link or onclick event:
About post-content, you can always re-send it. Browsers normally give you the option. I've tested this script in IE 4, 5, 6, NS4, NS6, NS7, Opera6, Opera7, pretty much any Gecko browser, and the script is so simple it should even work as far back as Netscape 2 and IE 3...
Code: Select all
<script language="JavaScript" type="text/javascript">
function changePage()
{
if (self.parent.frames.length != 0)
{
self.parent.location=self.parent.framesї1].location.href;
}
}
</script>This script only works if both sites are from the same domain, right? This gives me a permission denied error, because the frame I'm trying to maximize is from an external domain.Skyzyx wrote:Insert this into your top frame, and attach it to a link or onclick event:
About post-content, you can always re-send it. Browsers normally give you the option. I've tested this script in IE 4, 5, 6, NS4, NS6, NS7, Opera6, Opera7, pretty much any Gecko browser, and the script is so simple it should even work as far back as Netscape 2 and IE 3...Code: Select all
<script language="JavaScript" type="text/javascript"> function changePage() { if (self.parent.frames.length != 0) { self.parent.location=self.parent.framesї1].location.href; } } </script>