making your page invisible then visible

S

Stuart Wexler

Hi,

I have span tag around my form-- which is basically
my entire page-- that sets the display to none. I want
to, after running through some javascript care of the body
onload event, make the entire page visible again. How
do I do that?
 
D

David Dorward

Stuart said:
I have span tag around my form--

That's invalid, inline elements (span) can not contain block level elements
(form). You probably want a div instead... or apply the JS/CSS to the form
directly.
which is basically my entire page-- that sets the display to none. I
want to, after running through some javascript care of the body
onload event, make the entire page visible again. How
do I do that?

document.getElementById('foo').style.display = 'block';

.... and anyone in a browser which supports CSS but not JS is *&^$%^$ed.
 
G

Grant Wagner

Stuart said:
Hi,

I have span tag around my form-- which is basically
my entire page-- that sets the display to none. I want
to, after running through some javascript care of the body
onload event, make the entire page visible again. How
do I do that?

<body onload="makeVisible();">
<span id="mySpan" style="position:relative;visibility:hidden;"><!-- HTML
content --></span>
<script type="text/javascript">
function makeVisible() {
var element;
if (document.getElementById) {
// IE 5.5+, NS6+, Opera 6+
element = document.getElementById('mySpan').style;
} else if (document.layers) {
// NS4
element = document.layers['mySpan'];
} else if (document.all) {
// IE < 5.5, Opera 5(?)
element = document.all('mySpan').style;
}

if (element) {
element.visibility = 'visible';
} else {
alert("I hope you're reading this, because if you have
JavaScript off, you will see nothing");
}
}

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top