473,503 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: hide whole body but one div

On Jul 2, 5:57*pm, Jorge wrote:
<snip>
document.body.style.visibility= "none";
<snip>

The specified values for the CSS 'visibility' property do not include
'none'. Such a declaration should be ignored, and if not ignored can
be expected to be subject to inconsistent handling.
Jul 2 '08 #1
7 3531
On Jul 2, 7:09*pm, Henry <rcornf...@raindrop.co.ukwrote:
On Jul 2, 5:57*pm, Jorge wrote:
<snip>document.body.style.visibility= "none";

<snip>

The specified values for the CSS 'visibility' property do not include
'none'. Such a declaration should be ignored, and if not ignored can
be expected to be subject to inconsistent handling.
Hmmm, yes :

document.body.style.visibility= "hidden";
(document.getElementById('centerPage')).style.visi bility= "visible";

--Jorge
Jul 2 '08 #2
SAM
Jorge a écrit :
>
document.body.style.visibility= "hidden";
(document.getElementById('centerPage')).style.visi bility= "visible";
With an other way that could interest the OP :
- remove all divs and show the right one
Variante 1 : <http://cjoint.com/?hcvUjZSFGt>
Variante 2 : <http://cjoint.com/?hcvWd8I0zj>

I leave to you the opportunity to get time(s) of execution ;-)

--
sm
Jul 2 '08 #3
Thanks for your answers... I will study links you provided me.

What I want to do is to load some page (like google.com) hide it and
then display only one div.

Problem with visibility is that hidden elements still keep their
places... for that display="none" looks much better, but unfortunately
does not work with nested elements to be visible

Jul 2 '08 #4
On Jul 2, 9:51*pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Jorge a écrit :
document.body.style.visibility= "hidden";
(document.getElementById('centerPage')).style.visi bility= "visible";

With an other way that could interest the OP :
* - remove all divs and show the right one
Variante 1 : <http://cjoint.com/?hcvUjZSFGt>
Variante 2 : <http://cjoint.com/?hcvWd8I0zj>
Good idea. I have mixed all 3 in a single file : http://tinyurl.com/64h5x2

1.- Hide by setting style.visibility= "hidden"
2.- Hide by extracting the element out of document.body.
3.- Hide by setting style.display= "none".

But the OP question still remains unanswered : if
document.body.style.display === "none", is there a way to override
this setting on an inner element ?

I don't know the answer.

I know that document.body.style.visibility= "hidden" can be easily
overriden on an inner element just by setting the element's
style.visibility= "visible". How can this be done if
document.body.style.display === "none" ?
I leave to you the opportunity to get time(s) of execution ;-)
8-)

--Jorge
Jul 2 '08 #5
On Jul 3, 9:37*am, Jorge <jo...@jorgechamorro.comwrote:
On Jul 2, 9:51*pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Jorge a écrit :
document.body.style.visibility= "hidden";
(document.getElementById('centerPage')).style.visi bility= "visible";
With an other way that could interest the OP :
* - remove all divs and show the right one
Variante 1 : <http://cjoint.com/?hcvUjZSFGt>
Variante 2 : <http://cjoint.com/?hcvWd8I0zj>

Good idea. I have mixed all 3 in a single file :http://tinyurl.com/64h5x2

1.- Hide by setting style.visibility= "hidden"
2.- Hide by extracting the element out of document.body.
3.- Hide by setting style.display= "none".

But the OP question still remains unanswered : if
document.body.style.display === "none", is there a way to override
this setting on an inner element ?
That is a CSS question, the answer is in the CSS 2.1 Specification:

'display'
[...]
none
This value causes an element to generate no boxes in
the formatting structure (i.e., the element has no effect on
layout). Descendant elements do not generate any boxes either;
this behavior cannot be overridden by setting the 'display'
property on the descendants.

<URL: http://www.w3.org/TR/CSS21/visuren.html#propdef-display >

I don't know the answer.
You should now :-)
I know that document.body.style.visibility= "hidden" can be easily
overriden on an inner element just by setting the element's
style.visibility= "visible".
Because that is how visibility is specified to work:

<URL: http://www.w3.org/TR/CSS21/visufx.ht...def-visibility >
How can this be done if
document.body.style.display === "none" ?
It can't in a UA that conforms with CSS 2.1.
--
Rob
Jul 3 '08 #6
On Jul 3, 4:31*am, RobG <rg...@iinet.net.auwrote:
*'display'
*[...]

* * this behavior cannot be overridden by setting the 'display'
* * property on the descendants.

<URL:http://www.w3.org/TR/CSS21/visuren.html#propdef-display>
I don't know the answer.

You should now :-)
Clear as an azure sky of deepest summer.

/8¬)

Thanks,
--Jorge.
Jul 3 '08 #7
SAM
Jorge a écrit :
>
But the OP question still remains unanswered : if
document.body.style.display === "none", is there a way to override
this setting on an inner element ?

I don't know the answer.
I think : no.
I'm surprised that visibilty works.
But all that is a question of logic.
>I leave to you the opportunity to get time(s) of execution ;-)

8-)
¡Tanto peor! jamás lo sabría.

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

told us Evertjean

and button back to reverse I presume

Plus simple tu meurs ;-)

--
sm
Jul 3 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4625
by: oLE | last post by:
I would like to add some javascript to show/hide a certain row of a table. The first row of the table contain the hyperlink that calls the javascript the second row is the one i want to show/hide...
4
7980
by: jerryyang_la1 | last post by:
I've found this script that allows be to hide/show form elements.. <script language="JavaScript"><!-- var toggle = true; function show(object) { if (document.layers && document.layers)...
13
4481
by: Matt | last post by:
Does anyone know how to hide the ASPX extension of web pages in ASP.Net 2.0? Thanks, Matt
1
16723
by: asilverpeach | last post by:
Hey Guys! Found some great scripts here on this topic but have to make to changes to the code that I can't seem to figure out. First, In the following code clicking on the headers shows the...
11
19179
by: C.W.Holeman II | last post by:
I what to hide an input element and the following text. I have the selector for the input working and just need to grab the text following it. CSS: form{ display:table; text-align:center; }
6
2499
by: Jeremy | last post by:
I've got a floating div which becomes visible when a link is clicked. I want the div to be hidden when the user clicks anywhere on the page except for whithin the div. What is the best way to do...
7
1838
by: czechboy | last post by:
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.display="" it does not work... so...
1
3073
by: dhtml | last post by:
On Jul 2, 7:57 am, czechboy <oldrich.s...@gmail.comwrote: document.getElementById("centerPage").style.display="" Changes the style attribute. So whatever was in the cascade above (e.g a...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.