hi,
i am making a collapsable menu and at the moment are using show and hide functions to show and hide a <ul> when a link is clicked... which is working fine. What i am unsure of to do next, is how to have some sort of 'if' statement that will work so that if the menu is being shown, when the link's clicked it will apply the hide function, and vice versa. can anyone give me a hand or point me in the right direction of a tutorial where i can read up on how to do so. ill include my current code below.Code:function show() { for(var i=0; i<arguments.length; i++) { document.getElementById(arguments[i]).style.display = "block"; } } function hide() { for(var i=0; i<arguments.length; i++) { document.getElementById(arguments[i]).style.display = "none"; } } var str='<style type="text\/css" media="screen">'; str+='#menu1, #menu2, #menu3{display:none;}'; document.write(str+'<\/style>');thanks in advanceHTML Code:<a onclick="show('menu1');hide('menu2');return false;" href="#">menu</a>






Bookmarks