【发布时间】:2011-03-17 09:33:09
【问题描述】:
来自初学者的问题..
当鼠标从父 div 进出时,我想显示/隐藏一个内部 div。我首先尝试了onmouseover、onmouseout 事件,但问题是onmouseover 在鼠标悬停在 div 上时会一直触发,我希望它只触发一次。
我找到了可能对我有帮助的 JQuery 事件,但我不知道我可以将这段代码放在哪里,因为我的 div 存在于控件的模板中,并且 div 没有 onload 事件。
<script type="text/javascript" language="javascript">
// Where should I call this !!!
function Init(sender) {
$(sender).bind("mouseenter", function () {
$(sender.childNodes[1], this).show(500);
}).bind("mouseleave", function () {
$(sender.childNodes[1], this).hide(500);
});
}
</script>
任何帮助!
【问题讨论】:
-
请张贴您的代码。这让我们更容易为您提供帮助。
标签: javascript jquery asp.net