HighDots Forums  

Re: hide whole body but one div

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: hide whole body but one div in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dhtml
 
Posts: n/a

Default Re: hide whole body but one div - 07-03-2008 , 04:57 AM






On Jul 2, 7:57*am, czechboy <oldrich.s... (AT) gmail (DOT) com> wrote:
Quote:
Hi,
I can use document.body.style.display="none" to hide whole page but
then if I want to display one div only by
document.getElementById("centerPage").style.displa y="" it does not
work...

document.getElementById("centerPage").style.displa y=""

Changes the style attribute. So whatever was in the cascade above (e.g
a stylesheet), will be applied to the element. If the most specific
cascading stylesheet rule for that element had display: none, then
setting display="" the browser will apply that cascaded rule to that
element.

It is also entirely possible that the element's ancestor has display:
none, so in that case, setting the display of the element itself will
change it's style attribute but it won't generate any box for that
element (which is not rendered because its ancestor is not).

display can be, but is not by default, inherited. If the element has
display: inherit, it will take on the value of the element's parent's
display (inherit doesn't work in IE). However, if the element has an
ancestor with display: none, then it is not rendered (regardless of
whatever display it may have inherited from its parent). It will still
generate no box, no matter what.

[snip]

Quote:
thanks


Reply With Quote
  #2  
Old   
SAM
 
Posts: n/a

Default Re: hide whole body but one div - 07-03-2008 , 04:39 PM






dhtml a écrit :
Quote:
On Jul 2, 7:57 am, czechboy <oldrich.s... (AT) gmail (DOT) com> wrote:
Hi,
I can use document.body.style.display="none" to hide whole page but
then if I want to display one div only by
document.getElementById("centerPage").style.displa y="" it does not
work...

document.getElementById("centerPage").style.displa y=""
The answer has been given

in address bar type :

javascript:document.body.innerHTML=document.getEle mentById('centerPage').innerHTML;

To get back the page : button back ;-)

--
sm


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.