July 2, 200818 yr I have a ul element set to display:none I want to use javascript to change this to display:block, when the user goes mouseover on the parent li element. I'm fairly new to javascript. What's wrong / right with the approach below and / or the javascript. Thanks Andy <script type="text/javascript"> function displaymenu() {document.getElementById (submenu) submenu.style.display ="block"} </script> <ul id="nav"> <li onmouseover ="displaymenu"> <asp:HyperLink ID="lnkDefault" runat="server" NavigateUrl="~/Admin/Default.aspx">Admin Home</asp:HyperLink></li> <li> Content management <ul id="submenu">
July 2, 200818 yr Author I have a ul element set to display:none I want to use javascript to change this to display:block, when the user goes mouseover on the parent li element. I'm fairly new to javascript. What's wrong / right with the approach below and / or the javascript. Thanks Andy <script type="text/javascript"> function displaymenu() {document.getElementById (submenu) submenu.style.display ="block"} </script> <ul id="nav"> <li onmouseover ="displaymenu"> <asp:HyperLink ID="lnkDefault" runat="server" NavigateUrl="~/Admin/Default.aspx">Admin Home</asp:HyperLink></li> <li> Content management <ul id="submenu"> Sorted it now: <script type="text/javascript"> function displaymenu() {document.getElementById("submenu").style.display ="none"} </script>
Create an account or sign in to comment