...

View Full Version : IE Javascript events... onmouseout overwrites itself on the second call



C_elite
10-28-2006, 08:32 AM
Hello everyone and thanks to the hosts at codingforums for making my question possible :)

I am just trying to get the onmouseout event to work with my menu system, and I was wondering why, when you have two objects that do the same event, the first one gets cut off and stops doing what its doing. If anyone is interested, I will be glad to post my code that I have so far.

I'm using:
Internet Explorer 6
Windows XP Pro

If anyone needs any more info please let me know,
and thank you in advance to anyone who can help me out :),

C_elite

brandonH
10-29-2006, 09:16 AM
please post, I will be more than willing to assist. sounds like you have the same problem i encountered when i made my first menus. sounds to be a bubbling problem. look into stopping propagation.

C_elite
10-30-2006, 04:39 AM
<html>
<head>

<style>
.tds
{
background-Color:'E1E1E1';
width:100;
height:20;
text-align:center;
border:0px solid gray;
font-size:14;
filter:alpha(opacity=85);
-moz-opacity:45%;
cursor:hand;
}
</style>

<script language='javascript'>




function change_color(obj_name, start, end_c)
{
i = 0;

speed = 10;
obj_char = obj_name;
start_hex = start;
end_hex = end_c;
obj_hex = document.getElementById(obj_char);

red_s = parseInt(start.charAt(0)+start.charAt(1), 16);
red_e = parseInt(end_c.charAt(0)+end_c.charAt(1), 16);

green_s = parseInt(start.charAt(2)+start.charAt(3), 16);
green_e = parseInt(end_c.charAt(2)+end_c.charAt(3), 16);

blue_s = parseInt(start.charAt(4)+start.charAt(5), 16);
blue_e = parseInt(end_c.charAt(4)+end_c.charAt(5), 16);

i = 0;
if(red_s != red_e || green_s != green_e || blue_s != blue_e)
{
if(red_s < red_e-speed || red_s > red_e+speed)
{
if (red_s < red_e) { red_s = red_s + speed; }
else { red_s = red_s - speed; }
}
if(green_s < green_e-speed || green_s > green_e+speed)
{
if (green_s < green_e) { green_s = green_s + speed; }
else { green_s = green_s - speed; }
}
if(blue_s < blue_e-speed || blue_s > blue_e+speed)
{
if (blue_s < blue_e) { blue_s++; }
else { blue_s--; }
}

if(red_s != red_e)
{
if (red_s < red_e) { red_s++; }
else { red_s--; }
}
if(green_s != green_e)
{
if (green_s < green_e) { green_s++; }
else { green_s--; }
}
if(blue_s != blue_e)
{
if (blue_s < blue_e) { blue_s++; }
else { blue_s--; }
}

red_shift = red_s;
green_shift = green_s;

red_hex = red_shift.toString(16);
if(red_hex.length == 1) { red_hex = "0" + red_hex; }
green_hex = green_shift.toString(16);
if(green_hex.length == 1) { green_hex = "0" + green_hex; }
blue_hex = blue_s.toString(16);
if(blue_hex.length == 1) { blue_hex = "0" + blue_hex; }

color = red_hex + green_hex + blue_hex;
color_hex = red_hex + green_hex + blue_hex;

obj_hex.style.backgroundColor = color;
setInterval("change_color(obj_char, color_hex, end_hex)", 0);
}
}

</script>
</head>

<body>

<table name=link_table id=link_table>
<tr>
<td id="home" name="home" class="tds" onmouseover="this.style.backgroundColor='highlight';" onmouseout="change_color('home', '0000ff', 'e1e1e1');" onclick="window.location='#';">Home</td>
</tr>
<tr>
<td id="blah1" name="blah1" class="tds" onmouseover="this.style.backgroundColor='highlight';" onmouseout="change_color('blah1', '0000ff', 'e1e1e1');" onclick="window.location='#';">Blah</td>
</tr>
<tr>
<td id="blah2" name="blah2" class="tds" onmouseover="this.style.backgroundColor='highlight';" onmouseout="change_color('blah2', '0000ff', 'e1e1e1');" onclick="window.location='#';">Blah</td>
</tr>
</table>

</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum