toshka89 Posted April 21, 2007 Share Posted April 21, 2007 Hi there all!! I have a menu script so far that looks like this: java script: <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> HTML: <a href="#welcome" onClick="java script:showHide('welcome')"> <div class="button" id="welcomeb"><strong>welcome</strong></div></a> <div id="welcome" class="box">Welcome to Blah...!</div> <a href="#about" onClick="java script:showHide('about')"> <div class="button" id="aboutb"><strong>about</strong></div></a> <div id="about" class="box" style="display:none;">LALALA</div> I was wondering how I could modify it, so that when I click on one menu link, the other menu DIVs will close? A quick response will be HUGELY appreciated! Peace, Ant.. Link to comment https://forums.phpfreaks.com/topic/48041-solved-div-menu/ Share on other sites More sharing options...
V34 Posted April 21, 2007 Share Posted April 21, 2007 It's because you're calling the wrong element ID's. You have to call the ID of the Div. <a href="#welcome" onClick="java script:showHide('welcomeb')"> <div class="button" id="welcomeb"><strong>welcome</strong></div></a> <div id="welcome" class="box">Welcome to Blah...!</div> <a href="#about" onClick="java script:showHide('aboutb')"> <div class="button" id="aboutb"><strong>about</strong></div></a> <div id="about" class="box" style="display:none;">LALALA</div> Link to comment https://forums.phpfreaks.com/topic/48041-solved-div-menu/#findComment-234816 Share on other sites More sharing options...
toshka89 Posted April 22, 2007 Author Share Posted April 22, 2007 Cheers mate. Thanks. Peace, Ant.. Link to comment https://forums.phpfreaks.com/topic/48041-solved-div-menu/#findComment-234979 Share on other sites More sharing options...
V34 Posted April 22, 2007 Share Posted April 22, 2007 You're Welcome. Link to comment https://forums.phpfreaks.com/topic/48041-solved-div-menu/#findComment-234981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.