Menu
Hi, Can anyone tell me why this is not working? I’m just trying to get a div to be made visible or hidden at the click of a link.
<script language=”JavaScript”>
function showhide()
{
var testvar = document.getElementById(“mydiv”).style.visibility
if (testvar = “visible”)
{
document.getElementById(“mydiv”).style.visibility = “hidden”;
}
else
{
document.getElementById(“mydiv”).style.visibility = “visible”;
}
}
</script>
<div id=”mydiv” style=”visibility:visible;”>
Blah blah blah…
</div>
<a href=”javascript:showhide()”>Click here to enable the element<a/>