NLCJ Posted December 13, 2010 Share Posted December 13, 2010 Hello, I'm trying to hide and show something if it's shown (on mouseover) and vice versa when the mouse goes over the other div. However, it doesn't work (anymore). I've got no idea what happened. I changed something and it didn't work anymore (I tried CTRL + Z, didn't work). function menutop(hide, show){ var hide = document.getElementById(hide); if(hide.style.visibility == 'visible') { hide.style.visibility = 'hidden'; } if(hide.style.visibility == 'hidden') { hide.style.visibility = 'visible'; } var show = document.getElementById(show); if(show.style.visibility == 'visible') { show.style.visibility = 'hidden'; } if(show.style.visibility == 'hidden') { show.style.visibility = 'visible'; } } HTML code: <img onmouseover="menutop('dmenu', 'amenu')" src="button.png" width="30" height="30" id="amenu" style="visibility: visible;" /> <div id="dmenu" onmouseout="menutop('amenu', 'dmenu')" style="visibility: hidden;"> Thank you, Quote Link to comment https://forums.phpfreaks.com/topic/221525-hide-show-on-mouseover/ Share on other sites More sharing options...
NLCJ Posted December 13, 2010 Author Share Posted December 13, 2010 Nevermind, I've rewritten it: <script type="text/javascript"> function show(box){ document.getElementById(box).style.visibility="visible"; } function hide(box){ document.getElementById(box).style.visibility="hidden"; } </script> <img onmouseover="hide('amenu'); show('dmenu');" src="navigate.png" width="180" height="30" id="amenu" style="visibility: visible;" /> <div id="dmenu" onmouseout="hide('dmenu'); show('amenu');"> Works fine. Quote Link to comment https://forums.phpfreaks.com/topic/221525-hide-show-on-mouseover/#findComment-1146750 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.