views:

29

answers:

1

I'm using mouseover and mouseout event wherein which will change the images on mouseover and mouseout

And when users click on link, can we disable mouseout event, so that that respective function will not be called ?

<td><a href="javascript:void(0)" id="LikeId" onmouseover="like(1);" onmouseout="like(2);"><span id="greenimg" style="display:none"><img src="images/up_green.gif" border="0" /></span><span id="gimg"><img src="images/up.gif" border="0" /></span></a></td><td width="93%"><a href="javascript:void(0)" id="DisLikeId" onmouseout="dislike(2);" onmouseover="dislike(1);"><span id="redimg" style="display:none"><img src="images/down_red.gif" border="0" /></span><span id="rimg"><img src="images/down.gif" border="0" /></span></a></td>

Thanq

+1  A: 

You could just set a boolean variable (something like userClicked = true) in onclick and check it in your like() function.

In your like function, just surround the code with an if statement. Such as:

function like(parameter) {
    if (!userClicked) {
        // Your original like() code
    }
}
umop
yeah, i can check whether user clicked on the link...then how can i disaable mouseover event ?
luvboy
I edited the answer to address your comment.
umop
Did that answer your question?
umop