Image

Hide/Show Layer script

Head script


<script>

function hideshowlayer(LayerName) {



var VState = document.getElementById(LayerName).style.display;



document.title = LayerName +" "+document.getElementById(LayerName).style.display;



if (VState=="inline") {

document.getElementById(LayerName).style.display = "none";

}



if (VState=="none") {

document.getElementById(LayerName).style.display = "inline";

}



} //end function

</script>


Body


<a href='javascript:hideshowlayer("layer1");'>hide/show</a><br>

<span id="layer1" style="visibility: visible; display:inline; ">

<b>Showinglayer 1</b>

</span>



Tested on Internet Explorer 5.2 (Macintosh), FireFox 1.0 (Macintosh)

Thanks for the help from Imageadcott and Imagesaint_sava

Crossposted to Imagejavascript and Image_css