Ran into interesting problem in javascript – trying to open a popup on mouseover and close it on mouseout.
The window opens when ‘onclick’ is coded and occurs and it closes when mouseout occurs.
It does not open when ‘onmouseover’ is coded and occurs (onmouseout throws error because ‘chyld’ is not valued)
Why should onClick work and onMouseOver not work?
( BTW:
same occurs if event’s element is ‘<A…’ instead of ‘<IMG’….
same occurs on Win2K and WinXP using NS7 and IE6
*** IT WORKS FINE IN OPERA 7.11
<script type=”text/javascript”>
var chyld = “”
function openwin()
{
chyld = window.open(“helpcall.html”, “miniwin”, “scrollbars=auto, resizable=false, left=10, screenx=10, top=120, screeny=120, width=420, height=420”) ;
}
function closewin()
{
chyld.window.close()
}
</script>
THIS WORKS
<img src=”img1.gif” border=0 onclick=”openwin(); return false;” onMouseOut=”closewin(); return false;”>
THIS DOESN’T WORK:
<img src=”img2.gif” border=0 onMouseOver=”openwin(); return false;” onMouseOut=”closewin(); return false;”>