JavaScript设置表格的行隐藏和显示(第一行保留)

2017-08-13 16:44:29  访问(1710) 赞(0) 踩(0)


    var isShow = true;

    function OnShowHideTableDetail() {
        isShow = !isShow;

        // 获取第一个表格 //
        var ctrlTable = document.getElementById("tb_table");

        if (ctrlTable == null)
            return;

        var ctrlChild = ctrlTable.getElementsByTagName("tr");

        var iLen = ctrlChild.length;

        if (iLen == 0)
            return;

        var i = 0;
        var styleValue = "";
        if (!isShow)
            styleValue = "none";

        for (i = 1; i < iLen; ++i) {
            ctrlChild[i].style.display = styleValue;
        }
    }

    OnShowHideTableDetail();


上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)