zoukankan      html  css  js  c++  java
  • Javascript 操作合并table列rowspan

    <script language="JavaScript">
            function rowSpans_Cells(tab) {
                var maxCol = 5, val, count, start;  //maxCol:合并单元格作用到多少列    
                for (var col = maxCol - 1; col >= 0; col--) {
                    count = 1;
                    val = "";
                    for (var i = 0; i < tab.rows.length; i++) {
                        if (val == tab.rows[i].cells[col].innerHTML) {
                            count++;
                        } else {
                            if (count > 1) { //合并
                                start = i - count;
                                tab.rows[start].cells[col].rowSpan = count;
                                for (var j = start + 1; j < i; j++) {
                                    tab.rows[j].cells[col].style.display = "none";
                                }
                                count = 1;
                            }
                            val = tab.rows[i].cells[col].innerHTML;
                        }
                    }
                    if (count > 1) { //合并,最后几行相同的情况下
                        start = i - count;
                        tab.rows[start].cells[col].rowSpan = count;
                        for (var j = start + 1; j < i; j++) {
                            tab.rows[j].cells[col].style.display = "none";
                        }
                    }
                }
    
            }
            rowSpans_Cells(tb_qk);
        </script>
    View Code

    此代码是转载.

  • 相关阅读:
    RFC7296--Internet密钥交换协议版本2(IKEv2)
    IPSec 100问
    strongswan--函数定义宏
    RFC6311--协议支持IKEv2 / IPsec的高可用性
    IPSec之security acl
    华罗庚
    韩罗塔核心算法
    javaBean
    Servlet
    javaee Api
  • 原文地址:https://www.cnblogs.com/wucai543/p/3428704.html
Copyright © 2011-2022 走看看