By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,628 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,628 IT Pros & Developers. It's quick & easy.

make a frame invisible

P: n/a
Hi

I have hunted around for this one but been unable to find any definitive
answer.

I have a simple frameset with one frame above another. by clicking a
checkbox or some such in the lower frame the user can choose whether to have
the upper frame displayed or not.

I have tried frames["upper"].style.display="none" which looked right
according to the CSS spec but didn't work for me.

I don't want to have to reload the page without a frameset; I want to keep
the frameset in place but the lower frame fills the window and the user
cannot see or navigate to the upper frame. This should work in recent
versions of popular browsers (mandatory IE6 and Firefox)

Can this be done?

TIA

Andy
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Just off the top of the head, can you change the frame size of the
frame you want to hide, to be 0 (or make the other frame 100%,
whatever)? Can the "Rows" attribute of the Frameset tag be modified to
do this in DHTML? I would go this route.

Jul 23 '05 #2

P: n/a
Andy Fish wrote:
Hi

I have hunted around for this one but been unable to find any definitive answer.

I have a simple frameset with one frame above another. by clicking a
checkbox or some such in the lower frame the user can choose whether to have the upper frame displayed or not.

I have tried frames["upper"].style.display="none" which looked right
according to the CSS spec but didn't work for me.

I don't want to have to reload the page without a frameset; I want to keep the frameset in place but the lower frame fills the window and the user cannot see or navigate to the upper frame. This should work in recent versions of popular browsers (mandatory IE6 and Firefox)

Can this be done?

TIA

Andy


Remembered this from years past but, no idea how cross-browser it is.
Check it out if you like...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/str***ict.dtd">
<html>
<head>
<title>untitled</title>
<style type="text/css">
</style>
<script type="text/javascript">

function upperF()
{
return [
'<html><head></head>',
'<body style="background:coral;"',
'><h2>upper</h2></body>',
'</html>'].join('');
}
function lowerF()
{
return [
'<html><head></head>',
'<body style="background:moccasin;"',
'><h2>lower</h2><input type="checkbox" ',
'onclick="top.toggleUpper(this.checked)">',
' <span id="hs">hide</span> upper',
'</body></html>'].join('');
}

function toggleUpper(bWhich)
{
document.body.rows =
(bWhich) ? '0,*' : '20%,*';
lower.document.getElementById('hs').innerHTML =
(bWhich) ? 'show' : 'hide';
}

</script>
</head>
<frameset rows="20%,*">
<frame name="upper" src="javascript:top.upperF()">
<frame name="lower" src="javascript:top.lowerF()">
</frameset>
</html>

The relevant code is in toggleUpper, the rest is just for putting
everything in one file. hth

Jul 23 '05 #3

P: n/a
I just dynamically changed my frameset size, hope this helps you, I did
it this way:
parent.document.body.rows="100%,*"

This hid my bottom frame. It looks like the bottom 50% of my
screen is just whitespace.

Jul 23 '05 #4

P: n/a
<br*************@glic.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I just dynamically changed my frameset size, hope this helps you, I did
it this way:
parent.document.body.rows="100%,*"

This hid my bottom frame. It looks like the bottom 50% of my
screen is just whitespace.


Thanks Bruce (and RobB for the other reply)

I was able to get about 90% most of the way with DHTML, but I came unstuck a
bit with the borders. I need to have the frame border visible and resizable
when in 2-frame mode, and to look as if there is no frame there at all (i.e.
no frame borders) when in 1-frame mode.

After a lot of faffind about, I wasn't able to get something that looked
seamless in different browsers, so I have decided to reload the frameset
when when switching modes. At least I know this will be browser-independent.

Andy

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.