大家有没有遇到过这种情况,动态添加的click事件可以正常触发,但动态添加的blur事件不能触发,但是如果是静态的blur事件是可以触发的。为什么?代码如下:<body onload="Bind_Div('mmm')">
<input type="button" value="Testing" id="btn"  onclick="Show_Menu(this.id,'mmm',1,true)"/>

<div id="mmm" style="width:300px; height:400px; background-color:#99CC99; display:none;"></div>

</body><script language="javascript">
function Bind_Div(div_id){
var div=document.getElementById(div_id);

if (document.all) {
div.attachEvent("onblur", Call_Hide_Div(div_id)); /*改成onclick就可以的*/
}
else {
div.addEventListener("blur",Call_Hide_Div(div_id));
} }function Show_Menu(btn_id,div_id,cur_length,sign){
var cur_top,cur_left,target_top,target_left;
var act;
div=document.getElementById(div_id);
//var evt= ||event;

cur_left=getElementPositionX(btn_id);
cur_top=getElementPositionY(btn_id);

div.style.position="absolute"; div.style.top=cur_top+"px";
div.style.left=cur_left+cur_length+"px";
div.style.filter = 'alpha(opacity=' + cur_length + ')'; 
div.style.display="block";

if(sign){
if(cur_length<=100){
cur_length=cur_length+3;
clearTimeout(act);
act=setTimeout("Show_Menu('"+btn_id+"','"+div_id+"',"+cur_length+","+sign+")",2);
}
}else{ div.style.display="none"
//div.style.filter= 'alpha(opacity=0)'; 
//if(document.all){
//window.event.cancelBubble = true;
//}else{
//  evt.stopPropagation();
//}
// if(cur_length>=0){
// cur_length=cur_length-1;
// clearTimeout(act);
// act=setTimeout("Show_Menu('"+btn_id+"','"+div_id+"',"+cur_length+","+sign+","+evt+")",2);
// }
}

}function getElementPositionX(elemID){
   var offsetTrail = document.getElementById(elemID);
   var offsetLeft = 0;
   
   while(offsetTrail){
      offsetLeft += offsetTrail.offsetLeft;
      offsetTrail = offsetTrail.offsetParent;
   }
   
    if (navigator.userAgent.indexOf("Mac") != -1 &&typeof(document.body.leftMargin) != "undefined"){
        offsetLeft += document.body.leftMargin;
    }

    return offsetLeft;
}function getElementPositionY(elemID){
   var offsetTrail = document.getElementById(elemID);
   var offsetTop = 0;   while(offsetTrail){
      offsetTop += offsetTrail.offsetTop;
      offsetTrail = offsetTrail.offsetParent;
   }    if (navigator.userAgent.indexOf("Mac") != -1 &&typeof(document.body.leftMargin) != "undefined") {
        offsetTop += document.body.topMargin;
    }

    return offsetTop;
}</script>