| | |
Java OnMouseOver event
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2009
Posts: 18
Reputation:
Solved Threads: 0
Hi everyone, its been a while since i kast posted on here,
Im trying to make the following menu open on the mouseover event, but im having loads of problems, Whilst the menu system works great on the click event, Copy and paste this code if you are looking fro a good easy menu system for any webpage you may be designing.
What I would like is to haver the menu work on the OnMouseOver Event, Hoping someone can help,
Im trying to make the following menu open on the mouseover event, but im having loads of problems, Whilst the menu system works great on the click event, Copy and paste this code if you are looking fro a good easy menu system for any webpage you may be designing.
What I would like is to haver the menu work on the OnMouseOver Event, Hoping someone can help,
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script language="JavaScript" type="text/JavaScript"> <!-- menu_status = new Array(); function showHide(theid){ if (document.getElementById) { var switch_id = document.getElementById(theid); if(menu_status[theid] != 'show') { switch_id.className = 'show'; menu_status[theid] = 'show'; set_cookie(theid,'hide'); }else{ switch_id.className = 'hide'; menu_status[theid] = 'hide'; set_cookie(theid,'show'); } } } function showHideAll() { var menuState = get_cookie ('mymenu1'); menu_status['mymenu1']=menuState; showHide('mymenu1'); menuState = get_cookie ('mymenu2'); menu_status['mymenu2']=menuState; showHide('mymenu2'); menuState = get_cookie ('mymenu3'); menu_status['mymenu3']=menuState; showHide('mymenu3'); menuState = get_cookie ('mymenu4'); menu_status['mymenu4']=menuState; showHide('mymenu4'); } function get_cookie ( cookie_name ) { var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' ); if ( results ) return ( unescape ( results[1] ) ); else return null; } function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) { var cookie_string = name + "=" + escape ( value ); if ( exp_y ) { var expires = new Date ( exp_y, exp_m, exp_d ); cookie_string += "; expires=" + expires.toGMTString(); } if ( path ) cookie_string += "; path=" + escape ( path ); if ( domain ) cookie_string += "; domain=" + escape ( domain ); if ( secure ) cookie_string += "; secure"; document.cookie = cookie_string; } //--> </script> <style type="text/css"> .menu1{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .menu2{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .menu3{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .menu4{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .submenu{ background-color:#ffffff; display: block; height: 20px; padding-top: 2px; padding-left: 5px; color: #2a4c79; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; border-top:solid 1px #000000; } .hide{ display: none; } .show{ display: block; } </style> </head> </head> <body onLoad="javascript:showHideAll()"> <div style="width:135px; height:192px"> <a class="menu1" onClick="showHide('mymenu1')">Links</a> <div id="mymenu1" class="hide"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div> <a class="menu2" onClick="showHide('mymenu2')">Links</a> <div id="mymenu2" class="hide"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div> <a class="menu3" onClick="showHide('mymenu3')">Links</a> <div id="mymenu3" class="hide"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div> <a class="menu4" onClick="showHide('mymenu4')">Links</a> <div id="mymenu4" class="hide"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div>
Last edited by Ezzaral; 31 Days Ago at 4:32 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post. You should know this by 15 posts.
why did I ever start.....
If you have helped me in the past, or you help me in the future.
I say thanks to you all
it is appreciated
If you have helped me in the past, or you help me in the future.
I say thanks to you all
it is appreciated
0
#2 31 Days Ago
Try this:
~G
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script language="JavaScript" type="text/JavaScript"> <!-- menu_status = new Array(); function showHide(theid){ if (document.getElementById) { var switch_id = document.getElementById(theid); if(menu_status[theid] != 'show') { switch_id.className = 'show'; menu_status[theid] = 'show'; set_cookie(theid,'hide'); }else{ switch_id.className = 'hide'; menu_status[theid] = 'hide'; set_cookie(theid,'show'); } } } function showHideAll() { var menuState = get_cookie ('mymenu1'); menu_status['mymenu1']=menuState; showHide('mymenu1'); menuState = get_cookie ('mymenu2'); menu_status['mymenu2']=menuState; showHide('mymenu2'); menuState = get_cookie ('mymenu3'); menu_status['mymenu3']=menuState; showHide('mymenu3'); menuState = get_cookie ('mymenu4'); menu_status['mymenu4']=menuState; showHide('mymenu4'); } function get_cookie ( cookie_name ) { var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' ); if ( results ) return ( unescape ( results[1] ) ); else return null; } function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) { var cookie_string = name + "=" + escape ( value ); if ( exp_y ) { var expires = new Date ( exp_y, exp_m, exp_d ); cookie_string += "; expires=" + expires.toGMTString(); } if ( path ) cookie_string += "; path=" + escape ( path ); if ( domain ) cookie_string += "; domain=" + escape ( domain ); if ( secure ) cookie_string += "; secure"; document.cookie = cookie_string; } //--> </script> <style type="text/css"> .menu1{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .menu2{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .menu3{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .menu4{ background-color:#2a4c79; padding-left:5px; padding-top:2px; padding-bottom: 2px; display:block; text-decoration: none; color: #ffffff; height: 20px; font-family:Tahoma; font-size:12px; border-top:solid 1px #000000; } .submenu{ background-color:#ffffff; display: block; height: 20px; padding-top: 2px; padding-left: 5px; color: #2a4c79; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; border-top:solid 1px #000000; } .hide{ display: none; } .show{ display: block; } </style> </head> </head> <body onLoad="javascript<b></b>:showHideAll()"> <div style="width:135px; height:192px"> <a class="menu1" onmouseover="showHide('mymenu1')" onmouseout="showHide('mymenu1')">Links</a> <div id="mymenu1" class="hide" onmouseover="showHide('mymenu1')" onmouseout="showHide('mymenu1')"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div> <a class="menu2" onmouseover="showHide('mymenu2')" onmouseout="showHide('mymenu2')">Links</a> <div id="mymenu2" class="hide" onmouseover="showHide('mymenu2')" onmouseout="showHide('mymenu2')"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div> <a class="menu3" onmouseover="showHide('mymenu3')" onmouseout="showHide('mymenu3')">Links</a> <div id="mymenu3" class="hide" onmouseover="showHide('mymenu3')" onmouseout="showHide('mymenu3')"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div> <a class="menu4" onmouseover="showHide('mymenu4')" onmouseout="showHide('mymenu4')">Links</a> <div id="mymenu4" class="hide" onmouseover="showHide('mymenu4')" onmouseout="showHide('mymenu4')"> <a href="www.somewhere.com" title="Click to go somewhere" class="submenu">Somewhere Link</a> </div>
~G
![]() |
Similar Threads
- how to make an event in java programming?? (Java)
- java and using observable class (Java)
- a Java GUI based program using Swing classes, Vat (Java)
- line up JTextField GUI java & write to file (Java)
- problem in java cobe (Java)
- Java Internal frames (Java)
- java uses or overrides a deprecated API?? (Java)
- JAVA help ACTIONLISTENERS (Java)
- java price is right game help (Java)
- I can't implement a word count into my text editor (JAVA) (Java)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javascript stopped working in new version of firefox
- Next Thread: HELP!! Tabifier JavaScript blanking out tab
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor debugger dependent disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math media microsoft mimic object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post problem programming progressbar regex runtime scroll search security select session shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





