我有一行数据
<tr onclick="这里有个onclick事件(就说成A)">
<td><input type="image" id="sdf" onclick="这里有个onclick事件(就说成B)">"/>
</td>
</tr>请问各位大侠,我如何让点击image的时候不让它触发事件A(因为这样好像我不能触发事件B)...
急!!

解决方案 »

  1.   

    window.event.cancelBubble=true;//ie
    e.preventBubble();//not  ie
      

  2.   

    http://www.javaeye.com/topic/361360
      

  3.   

    好了,但是
    this._postbacksettings.async为空或不是对象,谢谢!!!
      

  4.   


    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ws_hgo/archive/2009/07/30/4395297.aspx
    <!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>JS中的事件冒泡</title>   
        <mce:script type="text/javascript"><!--   
        function ClickTr()   
        {   
          alert("TR");   
        }   
        function ClickTd()   
        {   
          alert("TD");   
          //如果不加下面的代码点击先会弹出TD然后弹出TR,原因是HTML是对象结构当点击AAA的时候(执行),会冒泡到TR-->table-->body->document->window,当用event.cancelBubble=true的时候就说明阻止该冒泡行为    
          event.cancelBubble=true;   
        }   
           
    // --></mce:script>   
    </head>   
    <body>   
    <div style="background-color:Azure;" mce_style="background-color:Azure;">目的当点击BBB的时候弹出TR,当点击AAA的时候弹出TD</div>   
    <table>   
    <tr onclick="ClickTr();">   
    <td onclick="ClickTd();">AAA</td>   
    <td>BBB</td>   
    </tr>   
    </table>   
    </body>   
    </html>  
      

  5.   


    function stopEvent(e) {
                e = e || window.event;
                if (e.preventDefaultDefault) {
                    e.preventDefault();
                }
                else {
                    e.returnValue = false;
                }
            }
      

  6.   

    上面的弄错了function stopBubble(e) {
                e = e || window.event;
                if (e.stopPropagation) {
                    e.stopPropagation();
                }
                else {
                    e.cancelBubble = true;
                }
            }