zoukankan      html  css  js  c++  java
  • 阻止冒泡 table表格取消选中最后一列

    <!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></title>
       
    </head>
    <body>
     
    <table border="1">
        <tr onclick="fn()">
            <td id="t1">取消了事件</td>
            <td >点我,我没取消</td>
            <td id="t2">取消了事件</td>
        </tr>
    </table>
     
     
      <script type="text/javascript">
     
          function stopBubble(e) {
              if (e && e.stopPropagation) {
                  e.stopPropagation();
              }
              else {
                  window.event.cancelBubble = true;
              }
          }
         
          document.getElementById('t1').onclick = function (e) {
              stopBubble(e);
          }
          document.getElementById('t2').onclick = function (e) {
              stopBubble(e);
          }
          function fn() {
              alert('s');
          }
     
        </script>
    </body>
    </html>
     
    <tr>
    <td width="102" style="border-right-style:none">隐藏右边框</td>
    <td width="119" style="border-left-style:none">隐藏左边框</td>
    </tr>
    <tr>
    <td style="border-top-style:none">隐藏上边框</td>
    <td style="border-bottom-style:none">隐藏下边框</td>
    </tr>
  • 相关阅读:
    第三周java学习总结
    第一周Java学习总结
    关闭窗体
    乱七八糟
    网页游戏资料
    timer控件的使用
    spread 签套循环改变颜色编号为颜色
    限制输入‘号的代码
    SQlcharindex命令
    限制输入类型
  • 原文地址:https://www.cnblogs.com/ljc1212/p/8710339.html
Copyright © 2011-2022 走看看