js动态表格笔记

var tablereport= document.getElementById('tablereport');
var logBodyHtml = ' ';
logBodyHtml += ' <table style="width: 100%; "> ';
logBodyHtml += ' <tbody tabindex="0" > ';
for(var i=1;i<logData.dataList.length;i++){
var contentData = logData.dataList[i];
var currencyQty = contentData.CURRENCYQTY;
if(currencyQty == null){
currencyQty =0;
}
var trHtml = "";
trHtml += ' <tr id="yui-rec0" style="font-size:28px;padding-left:100px;" > ';
trHtml += ' <td rowspan="2" style="text-align: center; width: 15%; height: 60px;color: #00ff00;font-size: 22px;border:2px dashed #f6cf72;border-right: 0px;border-top: 0px;"> ' + contentData.ITEMNO + " </td>" ;
trHtml += ' <td rowspan="2" style="text-align: center; width: 15%; height: 60px;color: #ffff00;font-size: 30px;border:2px dashed #f6cf72;border-right: 0px;border-top: 0px;"> ' + contentData.REQUIREQTY + " </td>" ;
trHtml += ' <td rowspan="2" style="text-align: center; width: 15%; height: 60px;color: #00ff00;font-size: 30px;border:2px dashed #f6cf72;border-right: 0px;border-top: 0px;"> ' + contentData.DISPATCHINGQTY + " </td>" ;
trHtml += ' <td rowspan="2" style="text-align: center; width: 15%; height: 60px;color: #ff0000;font-size: 30px;border:2px dashed #f6cf72;border-right: 0px;border-top: 0px;"> ' + contentData.LACKQTY + " </td>" ;
trHtml += ' <td rowspan="2" style="text-align: center; width: 20%; height: 60px;color: #00ff00;font-size: 26px;border:2px dashed #f6cf72;border-right: 0px;border-top: 0px;"> ' + contentData.UNITNO + " </td>" ;
trHtml += ' <td style="text-align: center; width: 20%; height: 60px;color: #00ff00;font-size: 26px;border:2px dashed #f6cf72;border-right: 0px;border-top: 0px;"> '+"绑定:" + contentData.BINDQTY + " </td>" ;
trHtml += '</tr> ';
trHtml += '<tr> ';
trHtml += ' <td style="text-align: center; width: 20%; height: 60px;color: #00ff00;font-size: 26px;border:2px dashed #f6cf72;border-right: 0px;border-top: 0px;"> ' +"通用:"+ currencyQty + " </td>" ;
trHtml += '<tr> ';
logBodyHtml += trHtml;

}
// console.log( logBodyHtml );
logBodyHtml += ' </tbody>' ;
logBodyHtml += ' </table> ';
tablereport.innerHTML=logBodyHtml ;

posted @ 2017-08-02 15:57  26键的人生  阅读(130)  评论(0编辑  收藏  举报