JQuery 提供了两种方式来阻止事件冒泡。方式一:event.stopPropagation();        $("#div1").mousedown(function(event){
            event.stopPropagation();
        });方式二:return false;        $("#div1").mousedown(function(event){
            return false;
        });但是这两种方式是有区别的。return false 不仅阻止了事件往上冒泡,而且阻止了事件本身。event.stopPropagation() 则只阻止事件往上冒泡,不阻止事件本身。

解决方案 »

  1.   

    看来我这些是白写的,看懂了再说。
     <input id="text1"  type="text" onclick="F_Bind_ZhongLeiClick(this)"  />
    ==el.onclick = function(e){F_Bind_ZhongLeiClick(text1)}
    你说能阻止吗? <input id="text1"  type="text" onclick="F_Bind_ZhongLeiClick(this);return false"  />
    ==el.onclick = function(e){F_Bind_ZhongLeiClick(text1)
    return false;
    }
      

  2.   

    你用<input id="text1"  type="text" onclick="F_Bind_ZhongLeiClick(this)"  />绑事件,最终都会转化为
    el.onclick = function(e){
    F_Bind_ZhongLeiClick(text1)
    }
    你e参数都获不了,怎么可以阻止。
      

  3.   

    <div onclick="alert(123)"><input id="text1"  type="text" onclick="F_Bind_ZhongLeiClick
    (this,event)"  /></div><script>function F_Bind_ZhongLeiClick(ele,e) {
    if(e.stopPropagation)e.stopPropagation();
    else e.cancelBubble=true;
    }</script>
      

  4.   

    上面用错图片了,这跟有区别的。我上面更正一下,
    是==这个。
    el.onclick = function(event){
    F_Bind_ZhongLeiClick(text1)
    }