View Full Version : Show - Hiding layer's

01-09-2004, 03:10 PM
Hi, i hope you guys can help me!!!

I want to have a javascript command that i can attach to a button which will make a layer on the page visible and another button that will make it invisible.

Thanks in advance, Chris

01-09-2004, 03:23 PM
give the layer an id

button code:
<button onclick="document.getElementById('LayerID').style.visibility='visible';">Show</button>
<button onclick="document.getElementById('LayerID').style.visibility='hidden';">Hide</button>

01-09-2004, 03:27 PM
oh cool thanks for the quick and useful reply.

Do you have any idea if this code will work to attach to a button in macromedia flash mx ?

01-09-2004, 03:39 PM
not being that familiar with flash, but last I checked the buttons had onclick functions I somewhat assume the code would run in those.

06-10-2004, 01:57 PM

Saw your hide/show button and works great in NS. How can I get it to work with IE?

07-05-2004, 12:25 AM
this is a nice and simple script. thank you very much!!

one question, tho.

how could i make the two buttons into one? meaning, have one button to show and hide the layer? Also, could i make it something else besides a button--Ex: a link? I was able to get it hidden on page load (onLoad in the body), which is nice.