make a frame invisible

A

Andy Fish

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
 
B

bruce_brodinsky

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.
 
R

RobB

Andy said:
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
 
B

bruce_brodinsky

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.
 
A

Andy Fish

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top