Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onMouseOver and onMouseOut on the DIV tag

Status
Not open for further replies.

greyone

Programmer
Dec 14, 2000
200
CA
i have two frames as follows. The first one has alink which shows up a menu on the next frame. The following is the code for menu layer:

<SCRIPT LANGUAGE=&quot;JavaScript1.2&quot; SRC=&quot;drift.js&quot;></SCRIPT>
<div id=dropmenu0 style=&quot;position:absolute;left:100;top:100;background-color:#CCCCCC;width:150;visibility:hidden;border:1px solid black ;padding:0px&quot; >
<script language=&quot;JavaScript1.2&quot;>
if (document.all)
dropmenu0.style.padding=&quot;1px&quot;
estr='<table border=0 width=&quot;150&quot; bordercolor=black cellpadding=&quot;1&quot; cellspacing=&quot;0&quot;>'
estr+='<tr><td align=&quot;left&quot; class=menu onmouseover=this.style.background=&quot;#FF0000&quot; onmouseout=this.style.background=&quot;#CCCCCC&quot;>'
for (i=0;i<menu1.length;i++)
document.write(estr + menu1+'</td></tr></table>')//loads
the array containing the links

</script>
</div>

the code for the top menu which shows and hides this layer is follows:
<script language=&quot;JavaScript1.2&quot;>

function show(w,object) {
if (w.document.layers &amp;&amp; w.document.layers[object] != null)
w.document.layers[object].visibility = 'visible';
else if (document.all)
w.document.all[object].style.left=4
w.document.all[object].style.top=0
w.document.all[object].style.visibility = 'visible';
}


function hide(w,object) {
if (w.document.layers &amp;&amp; w.document.layers[object] != null)
w.document.layers[object].visibility = 'hidden';
else if (document.all)
w.document.all[object].style.visibility = 'hidden';

}
</script>

<A href =&quot;&quot; onclick=&quot;show(parent.content,'dropmenu0');return false&quot;>


Now my problem is that i want the menu to show on click which it does but onmouseout of the layer it should hide. It gives me a problem if i put the onmouseover in the div tag. is there a solution.Please help
 
&quot;It gives me a problem if i put the onmouseover in the div tag.&quot; --> which div tag ?? your onclick is in a &quot;a&quot; tag !!!! which problem ??
 
Out of interest, I have had a similar problem (perhaps). I made a pop-up menu using a hidden layer that contained a table of links. When the top level link was clicked, a JavaScript function detected whether the layer was visible and if not, made it so, and if it was, made it hidden. Anyway, I wanted to make it so once you clicked on the top-level link, the menu would disappear when the mouse came off it. So I called the same JS function as above on the mouseOut from the span tag surrounding the pop-up menu. However, it seems that the way IE senses the span tag is a little strange. There seems to be little gaps between the cells of the table included in the span tag that don't count as mouseOver. Therefore, one can't drag the mouse over the popup menu without it flickering on and off. I hope this is clear...

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top