i use a simple bit of code to make a div collapse, this is it:
<script language="JavaScript">
<!--
function expand(param)
{
param.style.display=(param.style.display=="none")?"":"none";
}
//-->
</script>
what code do i add to make it recognise when one div is open an collapse the previous div?
here’s the link I’d use:
<a href="javascript:expand(document.getElementById('div1'))">Link 1</a>
<div id="div1" width="300px" style="display:none"></div>
Any ideas?
If you were willing to use jQuery, the selector of your interest is something along the lines of
For example, if I were to demonstrate with next & previous, I would do it something like this. With targeted links it would work by appending ID’s to the
divsand referencing those in thehrefattribute of `anchors’. (now included within example)Something to mess with: