Forum Moderators: open
I have a javascript menu that opens a box, once I click on a link:
<a href="javascript:toggle('window1')" class="links">Test</a> <=thi is the link
<span id="window1">Window1</span> <=this is the box/window that opens
<script type="text/javascript">
document.getElementById('Window1').style.display="none";
function toggle(Window1){
var listElementStyle=document.getElementById(Window1).style;
if (listElementStyle.display=="none"){
listElementStyle.display="block";
}
else{ listElementStyle.display="none";
}
}
</script>
The problem is that once a window is open, it stays open, until the link is clicked again. I plan to use multiple boxes like these on one page, but I only want one window/box to be open at a time. I believe, the best solution would be to simply close all other boxes, once you open a respective box.
Unfortunately, I don't know much about javascript, so your help would be greatly appreciated.
Alternatively, you would need to store all of your dialog windows in an array.