Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I acces the properties of a <div>-defined layer using JavaScri 1

Status
Not open for further replies.

Ducu

Programmer
Oct 2, 2003
30
RO
How can I acces/modify the properties of a <div>-defined layer using JavaScript user defined function. I am using IE 6.0 on a WIN XP HE.

Assuming that I have a layer defined like this:

<html>
<head>
<title>Exemple de layere</title>
</head>
<body>
<div id=&quot;Layer1&quot; style=&quot;top:100px;left:100px;height:100px;width:100px;background-color:blue;position:absolute;&quot;>
DDDDDDDDDDDDDDDDDDDDDDDDDDDD
</div>
</body>
</html>

How can I access/modify the visibility property of the layer.

I tried:

<script language=&quot;JavaScript&quot;>
function changeIt(){
document.Layer1.visibility=&quot;hide&quot;;
}
</script>

but it didn't work out.

Any suggestions ?

Thank you in advance,
Dan C. Nagy
 

Dan,

Use:

Code:
document.getElementById('Layer1').style.visibility = 'hidden';

and

Code:
document.getElementById('Layer1').style.visibility = 'visible';

Hope this helps,
Dan
 
It works fine.
Thank you very much BillyRay,
Dan.
 
Dan,

Thanks for this answer!

Cheers,


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top