Forum Moderators: open
<script type="text/javascript">
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
if(document.layers) //NN4+
{
document.layers[szDivID].visibility = iState? "show" : "hide";
}
else if(document.getElementById) //gecko(NN6) + IE 5+
{
var obj = document.getElementById(szDivID);
obj.style.visibility = iState? "visible" : "hidden";
}
else if(document.all)// IE 4
{
document.all[szDivID].style.visibility = iState? "visible" : "hidden";
}
}
</script>
The buttons:
input type="button" onClick="toggleBox('book',1);" value="show div">
<input type="button" onClick="toggleBox('book',0);" value="hide div">
what i would like to know is there any other way of executing the script attached to the button, can i attach it to a href? so that when i click text it performs the javascript or does it have to be a button? any suggestions greatfully recieved, i dont really want to use the button formatting in css if i can help it!
Dan