DotNetGnat
Programmer
Guys, I have this below code
it works fine and the divs expand and hide on clicking the hyperlinks...but when i exapnd the first div i want to close the div2 is it is open and vice versa...i mean i dont want both the div to be at the same time...
how can i do that...
thanks
-DNG
Code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function showHide(elementid){
if (document.getElementById(elementid).style.display == 'none'){
document.getElementById(elementid).style.display = '';
} else {
document.getElementById(elementid).style.display = 'none';
}
}
//-->
</SCRIPT>
</head>
<body>
<a href="javascript:showHide('div1')">Expand/Hide div1</a>
<div id="div1" style="display:none;border:thin solid;">
div1 content
</div>
<a href="javascript:showHide('div2')">Expand/Hide div2</a>
<div id="div2" style="display:none;border:thin solid;">
div2 content
</div>
</body>
</html>
it works fine and the divs expand and hide on clicking the hyperlinks...but when i exapnd the first div i want to close the div2 is it is open and vice versa...i mean i dont want both the div to be at the same time...
how can i do that...
thanks
-DNG