Hello all,
I'm having some frustration with showing/hiding divs...
Here's what I'm doing.
I have a tree menu on the left which I'm using a different function to expand/collapse. I'm using the below script to actually show the content on the right side of the page on click. On double click of the menu item I take the content away...
The code for the menu items is:
Code:
<DIV class='menutitle' onClick="show(true,'div1');" onDblClick="hide(true,'div1');">Welcome</DIV>
<DIV class='menutitle' onClick="show(true,'div3');" onDblClick="hide(true,'div3');">Control Panel</div>
Now - here is where I'm lost. Let's say I click on the div containing "Welcome". Right now - the content displays on the right.
If I double click - it goes away.
What I want to do now - however - is when I click on "Control Panel" make the div content be hidden for "Welcome" and now show the div content for Control Panel. Right now - if I click on Control Panel - the content shows - but underneath is still the content for Welcome.
Code:
<script type="text/javascript">
<!-- Begin
// quick browser tests
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (!document.all && document.getElementById) ? true : false;
function show(sw,obj) {
// show/hide the divisions
if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';
if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';
if (sw && ns4) document.layers[obj].visibility = 'visible';
if (!sw && ns4) document.layers[obj].visibility = 'hidden';
}
function hide(sw,obj) {
// show/hide the divisions
if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';
if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';
if (sw && ns4) document.layers[obj].visibility = 'hidden';
if (!sw && ns4) document.layers[obj].visibility = 'visible';
}
// End -->
</script>
Any thoughts would be very appreciated!
Thanks,
Rich