Javascript question
Out of context: Reply #9
- Started
- Last post
- 21 Responses
- CygnusZero40
How do I take the below and when you expand one, turn all others off? I know nothing about this stuff so I kind of need this code modified. I dont know how to execute multiple functions and all that and cant seem to get either option above to work.
<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>- Well I shouldnt say I know nothing, just not much of a javascript guy.CygnusZero4