日期:2014-05-16  浏览次数:20355 次

列表显示时,当数据不足pageSize时,自动补充空行JS


function initList(perPageSize){
//alert(perPageSize);
var listTable=document.getElementById("listTable");
    var rowLength = listTable.rows.length;
    //alert("rowLength"+rowLength);
    if( rowLength<=perPageSize ){
        for( var i=0 ; i<perPageSize-rowLength ; i++ ){
        //alert("ddd");
            var rowObj = listTable.insertRow();
            rowObj.className="c";
            for( var j=0 ; j<listTable.rows[ 0 ].cells.length ; j++ ){
            //alert("xxx");
                var cellObj=rowObj.insertCell();
                cellObj.style.height="24";
                //cellObj.innerHTML="ASDG";
            }
        }
    }
}