/    Sign up×
Community /Pin to ProfileBookmark

can’t hide <div> with <FRAMESET> elements

Hi All,
I have some problems with hiding div elements. My page has frames and depending on some parameter it’s supposed to show either 2 or 3 columns of frames. So, I placed the <FRAMESET> element inside <div>, but it doesn’t work. For example, in the code below, I’mtrying to hide “div1”, but it doesn’t work (I always see div1 instead of div2)…. How to hide <FRAMESET> elements? Thanks for any help!

[CODE]
<script type=”text/javascript”>
$(document).ready(function(){
$(‘div#div1’).hide();
});
</script>

<div id=”div1″>
<FRAMESET COLS=”*,*”>
<FRAME SRC=”page1.html”>
<FRAME SRC=”page2.html”>
</FRAMESET>
<NOFRAMES>Your browser does not support frames.</NOFRAMES>
</div>

<div id=”div2″>
<FRAMESET COLS=”*,*,*”>
<FRAME SRC=”page1.html”>
<FRAME SRC=”page2.html”>
<FRAME SRC=”page3.html”>
</FRAMESET>
<NOFRAMES>Your browser does not support frames.</NOFRAMES>
</div>
[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Jeff_MottJul 14.2009 — Several problems going on here. First, you can't have one frameset after another like that. There can be only one frameset, which replaces the body element. Though, that frameset may [i]contain[/i] other framesets.

Second, there's no body in this document, so you can't have DIVs or any other markup besides the frames-related markup.

And finally, setting a frame to display: none isn't something the browsers seem to allow. You just can't do it. Instead, you could redirect to a ready-made page with the appropriate frameset.
Copy linkTweet thisAlerts:
@qnxauthorJul 14.2009 — Thanks for your explanations!

> There can be only one frameset...

ok, it's clear, my intention was to have only one frameset and always hide the other one. When a user clicks one of the links on the page, the page is supposed to reload with a new frameset.

> Second, there's no body in this document, so you can't have DIVs or any other markup besides the frames-related markup.

Ok, I didn't know this, thanks.


Now I have to think about another way to solve this. The reason why I don't want to redirect to a ready-made page with a new frameset is that I hoped that if it's the same page then I'll keep the browsing history for some frames (and I need this!). I checked it like this: I have two files: frames.html and frames2.html defining different framesets. First, I'm surfing in one frameset defined in frames.html. Then I rename frames2.html into frames.html (in explorer :-) and reload the page in the browser. Now I have, a new frameset (with one more frame), but the same path in the URL field of the browser (frames.html). If I press "go back" (ALT + <--) then I can move back to the pages that I've visited in some frames before I've loaded a new frameset [COLOR="Red"]while staying on the page with a new frameset[/COLOR]! If I redirect to another file with a new frameset and then go back, then I just go to the old frameset.... With javascript I suppose one cannot rename files, even though the files are in his domain... is it so?
×

Success!

Help @qnx spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...