Solved

onmouseout problem with div menu

Posted on 2008-10-27
2
600 Views
Last Modified: 2012-05-05
Please see the attached code snippet below. I am displaying the menu with the img and div elements. when I click on the image drop down icon, the menu will be displaued(with div tags). I want to close the menu as soon as  I move the mouse out of the menu. can some one help me to resolve this issue. Thanks in advance.

<img id='IdReplyArrowImage1' alt=""

						             src='/ResultsReview/images/downbtn16x12.gif' height="20px" width="13px"

						

						             style='vertical-align:bottom; border-width:0px;display:inline;position:relative;left:-4px;'

						

						             onmouseover="this.style.cursor='hand';this.src='/ResultsReview/images/rec_pat_up.gif';"

						             onmouseout="this.style.cursor='default';this.src='/ResultsReview/images/downbtn16x12.gif';"

						             onclick="showPopupWindow(oPopup, document.all.popupLockDiv, document.all.IdReplyArrowImage1, -60, 0)">		

						             

									<div id="popupLockDiv" toggle="fade" style="display: none;" class="wfTitleMenu" style="overflow:auto; height:350px; z-index: 100;">

									  <div style="border:1 solid #000000; background-color:#F5F5F5; font-family:Arial,Helvetica,sans-serif; font-size:8pt">

									    <div id="stdDiv"

									         onmouseover="this.style.backgroundColor='#000000'; this.style.color='#FFFFFF'"

									         onmouseout="this.style.backgroundColor='#F5F5F5'; this.style.color='#000000'"

									         style = "cursor:hand" onclick="parent.onSaveAndPrint('Standard');">&nbsp;Standard</div>

									

									    <div id="lrDiv"

									         onmouseover="this.style.backgroundColor='#000000'; this.style.color='#FFFFFF'"

									         onmouseout="this.style.backgroundColor='#F5F5F5'; this.style.color='#000000'"

									         style = "cursor:hand" onclick="parent.onSaveAndPrint('Legal-Record');">&nbsp;Legal-Record

									         </div>  

									         

									     <div id="pmDiv"

									         onmouseover="this.style.backgroundColor='#000000'; this.style.color='#FFFFFF'"

									         onmouseout="this.style.backgroundColor='#F5F5F5'; this.style.color='#000000'"

									         style = "cursor:hand" onclick="parent.onSaveAndPrint('Patient-Mailer');">&nbsp;Patient-Mailer

									     </div>

									     <div id="lhDiv"

									         onmouseover="this.style.backgroundColor='#000000'; this.style.color='#FFFFFF'"

									         onmouseout="this.style.backgroundColor='#F5F5F5'; this.style.color='#000000'"

									         style = "cursor:hand" onclick="parent.onSaveAndPrint('Letter-Head');">&nbsp;Letter-Head

									     </div>        

									   </div>     

									</div>

Open in new window

0
Comment
Question by:ukapu2005
2 Comments
 

Author Comment

by:ukapu2005
ID: 22822815
please send me the answer as early as possible
0
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 500 total points
ID: 22852393
To have a menu stay , you need to add mouseout event trigger to menu(div).

Look at the attached sample.
Also instead setting each display attribute separately, use CSS class and do the className assignments on
mouseover  and mouseout events.



<html>
<head>
<title>Document/Page Title</title>
<style type="text/css">
.show {
display: block;
background-color: #4499dd;
width: 200px;
}
.hide {
display: none;
}
.l1 {
background-color: #FF99FF;
}
.l2 {
background-color: #99FF99;
}
</style>
<script language="javascript">
function showhide(menuId, flag) {
var class = "hide";
if (flag==1) {
class = "show"
}
document.getElementById(menuId).className = class;
}
</script>
</head>
<body>
<img src="Img1.gif" onmouseover="showhide('menu1',1);" >
<div id="menu1" class="hide" onmouseover="showhide('menu1',1);" onmouseout="showhide('menu1',0);">
      <ul>
      <li class="l1"><a href="http:\\www.yahoo.com">Yahoo</a></li>
      <li class="l2"><a href="http:\\www.microsoft.com">Microsoft</a></li>
      <li class="l1"><a href="http:\\www.google.com">Google</a></li>
      </ul>
</div>
</body>
</html>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Following as example - where do I place this javascript line? 6 31
Allow space in this pattern 2 47
Jquey and footrable 2 35
ngStyle with an input variable doesn't work 14 30
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now