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>
  • 相关阅读:
    Python open() 函数
    python中的多重循环
    网络爬虫构造出URL的列表数据
    js自定义类和对象及继承
    最全的CSS浏览器兼容问题
    大型网站性能优化(页面(HTML)优化的方法)
    element-ui el-table有设置固定列fixed,高度不对的情况
    伊始
    【Object-C】Object-C 的包装类
    【Object-C】处理对象:description 方法、isEqual方法
  • 原文地址:https://www.cnblogs.com/ljc1212/p/8710339.html
Copyright © 2011-2022 走看看