set a div tag property to visible or hide from javascript

G

Guest

I need to set my div tag

(<div id="divBioBottom"> content </div>)

to either visible or hidden from javascript. Does anyone know how to do this?

Thanks.
7078895

/ra
 
F

Fabian

SpamProof hu kiteb:
I need to set my div tag

(<div id="divBioBottom"> content </div>)

to either visible or hidden from javascript. Does anyone know how to
do this?

You can't set it to be invisible or hidden from javascript. Javascript
is the all-seeing eye, at least within teh context of a html page.
however, you can use a css, and even manipulate css properties with
javascript, to make it invisible or hidden to the average human at teh
other end of the gui.
 
K

kaeli

I need to set my div tag

(<div id="divBioBottom"> content </div>)

to either visible or hidden from javascript. Does anyone know how to do this?

Thanks.
7078895

/ra

(not tested - watch for typos)
IE4+ and NN6+ should be fine with this. Dunno about other browsers, but
Opera had a problem with styles the last I checked (which was a couple
versions ago, so might be fixed).
Add a layers statement for NN4.

<div id="divBioBottom" name="divBioBottom">

if (document.getElementById)
{
if (document.getElementById("divBioBottom").style)
document.getElementById("divBioBottom").style.visibility="hidden";
}
else if (document.all && !document.getElementById)
document.divBioBottom.visibility="hidden";

--
 
R

Robert Meineke

I need to set my div tag
(<div id="divBioBottom"> content </div>)

to either visible or hidden from javascript. Does anyone know how to do this?

Is this what you are looking for? (Works in NN 7.0, Linux box)

<html>
<head>
<script type = "text/javascript">
<!--
function hide(x) {
document.getElementById(x).style.display='none';
}
function show(x) {
document.getElementById(x).style.display='';
}
//-->
</script>
</head>
<body>
<input type="button" value="Show" onClick="show('divBioBottom')">
<input type="button" value="Hide" onClick="hide('divBioBottom')">
<br>

Line 1<br>
<div id="divBioBottom">
content
</div>
Line 3<br>
</body>
</html>


Regards,
Robert
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top