本帖最后由 kisssmile 于 2012-10-18 11:56:18 编辑

解决方案 »

  1.   

    点击aaa时动态绑定onblur事件
    点击子项时先解除aaa的onblur事件的绑定
      

  2.   

    这样不行哦!动态绑定以后,点击bbb的子项的时候还是会并发,然后bbb子项的onclick事件没有触发···
      

  3.   


    这样不行哦!动态绑定以后,点击bbb的子项的时候还是会并发,然后bbb子项的onclick事件没有触发···
      

  4.   

    这个效果?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
    <script type="text/javascript">
    function $(id){ return document.getElementById(id);}function showhide(bShow){
    $("b").style.display=bShow?'':'none';
    if(!bShow){$("b"),innerHTML="";}
    }
    </script>
    </head><body> <div id=a style="width:300px;height:20px;border:1px solid red;" onclick="showhide(true);" onblur="showhide(false)">AAAAAAAAAA </div>
    <div id=b style="display:none">
    <ul>
    <li>11111111111111111111</li>
    <li>22222222222222222222</li>
    <li>33333333333333333333</li>
    </ul>
    </div> 
    </body>
    </html>
      

  5.   


    onclick 事件在 li 里面 而且是删除 id为b的DIV 当然 点击li的时候不只是删除DIV 还有其他的操作
    onblur的操作主要是删除id为b的DIV 有什么办法可以解决么?谢谢你的帮助
      

  6.   

    这样可以吗?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
    <script type="text/javascript">
    function $(id){ return document.getElementById(id);}function kisssmile(bCreate,o){
      if(!bCreate){
        if(o.tagName=="LI"){ 
          alert("do your things here.....");
        }
        $("b").parentNode.removeChild($("b"));
      }
      else{
        if($("b")){return;}
        var div=document.createElement("<div>");
        div.innerHTML=sHTML;
        $("wraper").appendChild(div);
      }
    }var sHTML="<div id=b style='width:300px;height:200px;border:1px solid blue;'><ul>";
    var arr=["11111111111111111111","22222222222222222222","33333333333333333333"];
    for(var i=0;i<3;i++){
      sHTML+="<li onmousedown='kisssmile(false,this);'>"+arr[i]+"</li>";
    }
    sHTML+="</ul>";
    </script>
    </head>
    <body> 
    <div id='wraper'>
      <div id=a style="width:300px;height:20px;border:1px solid red;" onclick="kisssmile(true);" onblur="kisssmile(false,false);">AAAAAAAAAA </div>  
    </div>
    </body>
    </html>
      

  7.   


    不太明白楼主的意思, 你是说 a 里面有一个onblur 事件,然后 a div 下面的 b div  有个下拉框也有一个事件并发了?  不好处理? 你为什么一定要把 =b 的 div  放在 =a 的div 里面呢?拿出来不行么?
      

  8.   

    this.parentNode.innerHTML = edtor.value = this.value;