Hello -
I have a show/hide script working nicely, but currently it is allowing more than 1 div to be opened at the time. How can I get it to collapse/hide one div when another is expanded?
Here is sample code:
The JavaScript:
--------------
The HTML:Code:// SHOW / HIDE CONTENT FUNCTION function HideContent(d) {document.getElementById(d).style.display = "none";} function ShowContent(d) {document.getElementById(d).style.display = "";} function ReverseContentDisplay(d) {if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = ""; }else { document.getElementById(d).style.display = "none"; }}
----------
Trigger link:
Hidden div:Code:<a href="javascript:ReverseContentDisplay('ca')">California</a>
Your help would be greatly appreciated!Code:<div id="ca" class="city-list" style="display:none;"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="purple"> <tr> <td colspan="5" align="right" valign="bottom"><a href="javascript:HideContent('ca')"><img src="assets/img/x-2.gif" alt="x" width="14" height="11" vspace="5" hspace="10" /></a></td> </tr> <tr> <td width="30%"><a href="#">Alameda</a></td> <td width="5%"> </td> <td width="30%"><a href="#">Indio</a></td> <td width="5%"> </td> <td width="30%"><a href="#">Redlands</a></td> </tr> <tr> <td><a href="#">Culver City</a></td> <td> </td> <td><a href="#">Mission Viejo</a></td> <td> </td> <td><a href="#">San Ramon</a></td> </tr> <tr> <td><a href="#">Hancock Park</a></td> <td> </td> <td><a href="#">Palm Springs</a></td> <td> </td> <td><a href="#">Studio City</a></td> </tr> <tr> <td colspan="5"> </td> </tr> </table> </div>
Thanks,
oslofish





Bookmarks