I let four pictures have same effects Like this:
<img src="brjj2.jpg" alt="" width="138" height="91" border="0" style="FILTER:alpha(opacity=20)" onMouseOver=high(this) onMouseOut=low(this)>
high(this) and Low(this) function is to let the picture highlight in and fade out. It works well when I try one by one. But when I move the cursor from one picture to another a little faster. The former picture stoped fading. I try to use different function for different picture. But it failed. Seems that the old "this" was replace by new "this".I am so confused. I really want to solve this, help? Following is my code.
function high(which2){
if (window.lowlighting)//if lowlighting...
clearInterval(lowlighting)
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
//lowlighting picture
function low(which2){
if (window.highlighting)//if highlighting...
clearInterval(highlighting)
theobject=which2
lowlighting=setInterval("lowlightit(theobject)",50)
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
if(cur2.filters.alpha.opacity==100)
if (window.highlighting)
clearInterval(highlighting)
}
function lowlightit(cur2){
if (cur2.filters.alpha.opacity<20)
if (window.lowlighting)
clearInterval(lowlighting)
if (cur2.filters.alpha.opacity>20)
cur2.filters.alpha.opacity-=5
else if (window.lowlighting)
clearInterval(lowlighting)
}
-<-@ W.H @->-
<img src="brjj2.jpg" alt="" width="138" height="91" border="0" style="FILTER:alpha(opacity=20)" onMouseOver=high(this) onMouseOut=low(this)>
high(this) and Low(this) function is to let the picture highlight in and fade out. It works well when I try one by one. But when I move the cursor from one picture to another a little faster. The former picture stoped fading. I try to use different function for different picture. But it failed. Seems that the old "this" was replace by new "this".I am so confused. I really want to solve this, help? Following is my code.
function high(which2){
if (window.lowlighting)//if lowlighting...
clearInterval(lowlighting)
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
//lowlighting picture
function low(which2){
if (window.highlighting)//if highlighting...
clearInterval(highlighting)
theobject=which2
lowlighting=setInterval("lowlightit(theobject)",50)
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
if(cur2.filters.alpha.opacity==100)
if (window.highlighting)
clearInterval(highlighting)
}
function lowlightit(cur2){
if (cur2.filters.alpha.opacity<20)
if (window.lowlighting)
clearInterval(lowlighting)
if (cur2.filters.alpha.opacity>20)
cur2.filters.alpha.opacity-=5
else if (window.lowlighting)
clearInterval(lowlighting)
}
-<-@ W.H @->-