Javascript question
Out of context: Reply #17
- Started
- Last post
- 21 Responses
- CygnusZero40
Ok, guys I dont know javascript. Pretend this is my very first day doing this. How do I take this code and make it so that when the buttons are clicked, all are collapsed. PLEASE edit this code. Dont send snippets of code. I do not know how to implement what youre sending.
<script type="text/javascript">
function hideshow(which){
if (!document.getElementById)
return
if (which.style.display=="block")
which.style.display="none"
else
which.style.display="block"
}
</script>
<a href="javascript:hideshow(document.getElementById('adiv1'))">Option 1</a>
<div id="adiv1" style="font:24px bold; display: block">Option 1 description</div>
<a href="javascript:hideshow(document.getElementById('adiv2'))">Option 2</a>
<div id="adiv2" style="font:24px bold; display: block">Option 2 description</div>
<a href="javascript:hideshow(document.getElementById('adiv3'))">Option 3</a>
<div id="adiv3" style="font:24px bold; display: block">Option 3 description</div>