vince
03-29-2001, 12:42 AM
im curious why this works the way it does. (code at bottom)
IE 5.5 only
first, putting on mouse events with the first div tag and calling the functions
causes the div element to appear or disappear everytime the mouse is moved,
thus blinking very quickly.
IE 5.5 and NS 6
second, putting on mouse events with the second div tag and addressing them
directly causes the same result as calling the functions.
IE 5.5 only
third, putting on mouse events in any tag other than the one that you want
to show/hide such as - a or img or div, etc. - and calling the functions,
causes the div element to appear and disappear appropriately
i would expect NS 6 to behave the way it does for the 1st and 3rd senarios
since they use document.all, but i am puzzled by the blinking behavior, that
is the on mouse events fire on every mouse movement, not moving in and out
of the div element. i dont necessarily need alteratives (i know i can use
getElementByID()), but i do really want to know what the deal with this code.
thanks for any help, you can see it at http://www.mindspring.com/~isont/t.htm
if necessary.
<script language=javascript>
<!--
function show(layerName)
{
document.all[layerName].style.visibility = "visible";
}
function hide(layerName)
{
document.all[layerName].style.visibility = "hidden";
}
//-->
</script>
<div id="firstLayer" onmouseover="hide('firstLayer');" onmouseout="show('firstLayer');"
style="position : absolute; top : 100px; left : 100px; height : 100px; width
: 100px; zindex : 1; background-color : blue; visibility : visible;">
</div>
<div id="secondLayer" onmouseover="this.style.visibility='hidden';" onmouseout="this.style.visibility='visible';"
style="position : absolute; top : 100px; left : 200px; height : 100px; width
: 100px; zindex : 1; background-color : red; visibility : visible;">
</div>
<a href=somepage.htm onmouseover="hide('firstLayer');" onmouseout="show('firstLayer');">move
mouse over to make first layer disappear</a>
IE 5.5 only
first, putting on mouse events with the first div tag and calling the functions
causes the div element to appear or disappear everytime the mouse is moved,
thus blinking very quickly.
IE 5.5 and NS 6
second, putting on mouse events with the second div tag and addressing them
directly causes the same result as calling the functions.
IE 5.5 only
third, putting on mouse events in any tag other than the one that you want
to show/hide such as - a or img or div, etc. - and calling the functions,
causes the div element to appear and disappear appropriately
i would expect NS 6 to behave the way it does for the 1st and 3rd senarios
since they use document.all, but i am puzzled by the blinking behavior, that
is the on mouse events fire on every mouse movement, not moving in and out
of the div element. i dont necessarily need alteratives (i know i can use
getElementByID()), but i do really want to know what the deal with this code.
thanks for any help, you can see it at http://www.mindspring.com/~isont/t.htm
if necessary.
<script language=javascript>
<!--
function show(layerName)
{
document.all[layerName].style.visibility = "visible";
}
function hide(layerName)
{
document.all[layerName].style.visibility = "hidden";
}
//-->
</script>
<div id="firstLayer" onmouseover="hide('firstLayer');" onmouseout="show('firstLayer');"
style="position : absolute; top : 100px; left : 100px; height : 100px; width
: 100px; zindex : 1; background-color : blue; visibility : visible;">
</div>
<div id="secondLayer" onmouseover="this.style.visibility='hidden';" onmouseout="this.style.visibility='visible';"
style="position : absolute; top : 100px; left : 200px; height : 100px; width
: 100px; zindex : 1; background-color : red; visibility : visible;">
</div>
<a href=somepage.htm onmouseover="hide('firstLayer');" onmouseout="show('firstLayer');">move
mouse over to make first layer disappear</a>