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);">开发者_JAVA百科<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>
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
}
}
精彩评论