Connecting Tech Pros Worldwide Help | Site Map

Re: hide whole body but one div

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 3rd, 2008, 09:05 AM
dhtml
Guest
 
Posts: n/a
Default Re: hide whole body but one div

On Jul 2, 7:57*am, czechboy <oldrich.s...@gmail.comwrote:
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 ;)

  #2  
Old July 3rd, 2008, 08:45 PM
SAM
Guest
 
Posts: n/a
Default Re: hide whole body but one div

dhtml a écrit :
Quote:
On Jul 2, 7:57 am, czechboy <oldrich.s...@gmail.comwrote:
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.displ ay="" 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.