日期:2014-05-16  浏览次数:20623 次

在javascript如何删除onmouseover事件?
<div   id= "gg "   onmousedown= "aa() "   onmouseover= "bb() "> test </div>
<script>
function   aa(){
//在次放使onmouseover失效的代码
}
</script>

------解决方案--------------------
<div id= "gg " onmousedown= "aa() " onmouseover= "bb() "> test </div>
<script>
function aa(){
return false;
//在次放使onmouseover失效的代码
}
</script>

------解决方案--------------------
<div id= "gg " onmousedown= "aa(this) " onmouseover= "bb() "> test </div>
<script>
function aa(el){
el.onmouseover=null;
//在次放使onmouseover失效的代码
}
function bb(){
alert( "asd ");
}
</script>
------解决方案--------------------
<div id= "gg " onmousedown= "aa() " onmouseover= "bb() "> test </div>
<script>
function aa(){
//在次放使onmouseover失效的代码
gg.onmouseover = "return false; ";
}
</script>


首先 bb()不能是抢夺焦点的事件