How do I get JS to change a <div> 's visibility,
I have:
<div id="main" style="visibility: show">
but I want a link like this
<a href="#" onclick="switchMain()">Change</a>
and clicking on that link will hide or show the layer.
I tried
Code:
function getStyle()
{
var temp = document.getElementById("main").style.visibility;
return temp;
}
function switchMain()
{
var current = getStyle();
if( current == "show" )
{
document.getElementById("main").style.visibility = "hidden";
}
else
{
document.getElementById("main").style.visibility = "show";
}
}
but it doesnt work ? ?
