我在页面中和图像的“onmouseover”事件中有图像我将调用一个javascript函数来显示工具提示并在图像的“onmouseout”,我会调用一个方法来隐藏tooltip.Now我发现,当我将光标放在图像上,它调用的方法来显示工具提示div.and如果我将鼠标WITHIN它的图像,它调用的onmouseout事件(即使我不是图像)。我可以如何阻止这一点。当光标不在图像中时,我想要调用onmouseout?有什么想法吗 ?在此先感谢javascript:OnMouseout事件被调用时,我将光标移到元素上而不会去掉元素的输出
这是我如何称呼它
<img src="images/customer.png" onmouseout="HideCustomerInfo()" onmouseover="ShowCustomerInfo(485)" />
和我的javascript
function ShowCustomerInfo(id) {
var currentCustomer = $("#hdnCustomerId").val();
if (currentCustomer != id) { // to stop making an ajax call everytime when the mouse move on the same image
$.get('../Lib/handlers/userhandler.aspx?mode=custinfo&cid=' + id, function (data) {
strHtml = data;
});
tooltip.show(strHtml); // method in another jquery pluggin
$("#hdnCustomerId").val(id);
}
}
function HideCustomerInfo() {
tooltip.hide(); // method in another jquery pluggin
$("#hdnCustomerId").val(0); //setting in a hidden variable in the page
}
不是鼠标悬停在工具提示上。而是将鼠标悬停在我附加了鼠标悬停事件的工具提示显示方法的图像上 – Shyju 2010-09-27 16:25:49
您可以添加标记和代码吗? – jimplode 2010-09-27 16:26:49
尝试绑定到mouseleave而不是mouseout?这是使用jquery吗? – jimplode 2010-09-27 16:36:33