用js创建一个页面的代码

js创建页面代码

function CreateHTML(_data) {
        var inTime=getInTimeDate(gPurchaseTime)
        var rowdata = _data;
        var _index = 1;
        var content = "";
        content+="<div class=\"div_print_info_portait PageNext\">";
        content+="<h1 align=\"center\"></h1>";
        content+="<form id=\"ff\" method=\"post\" style=\"width:100%;\">";

        content+="<table cellspacing=\"4\" id=\"head\"  style=\"margin-top: 10px;margin-left: 0px;margin-bottom: 0px;\">";
        content+="<tr>";
        content+="<th>订单编号:</th>";
        content+="<th colspan=\"7\"><input type=\"text\" name=\"ORDER_NO\" value='";content+= orderNo;
        content+="' + class=\"print_text_style\" /></th>";
        content+="</tr>";
        content+="<tr>";
        content+="<th>采购员:</th>";
        content+="<th colspan=\"7\"><input type=\"text\" name=\"ORDER_NO\" value='"; content+= puchaseName;
        content+="' class=\"print_text_style\" /></th>";
        content+="<th>采购时间:</th>";
        content+="<th colspan=\"7\"><input type=\"text\" name=\"ORDER_NO\" value='"; content+= inTime;
        content+="'class=\"print_text_style\" /></th>";
        content+="</tr>";
        content+="</table>";

        content+="<table id=\"OrderInforTable\" class=\"altrowstable printtable\" style=\"margin-top: 0px;\">";
        content+="<tr>";
        content+="<th id=\"type\"><div>序号</div></th>";
        content+="<th id=\"name\"><div>商品名</div></th>";
        content+="<th id=\"unit\"><div>单位</div></th>";
        content+="<th id=\"count\"><div>数量</div></th>";
        content+="<th id=\"house\"><div>仓库</div></th>";
        content+="<th id=\"remarks\"><div>备注</div></th></tr>";
        content+="</table>";

        content+="<table id=\"footer\" class=\"altrowstable printtable\" style=\"margin-top: 0px;\">"
        content+="<tr>";
        content+="<th >供应商(签字) </th>";
        content+="<td colspan=\"2\"> ";
        content+="<input class=\"print_text_style\" >";
        content+="</td>";
        content+="<th >库管员(签字) </th>";
        content+="<td colspan=\"2\"> ";
        content+="<input class=\"print_text_style\" >";
        content+="</td>";
        content+="<td colspan=\"2\"> ";
        content+="第";
        content+=content_indx;
        content+="页";
        content+="</td>";
        content+="<td colspan=\"2\"> ";
        content+="共";
        content+=gPageNum;
        content+="页";
        content+="</td>";
        content+="</tr>";
        content+="</table>";

        content+="</form>";
        content+="</div>";
        $("#printContent").append(content);
        content_indx = content_indx + 1;
        $("#OrderInforTable").attr("id", "OrderInforTable" + content_indx);
        var newTd = new Array();
        var s = document.getElementById("OrderInforTable" + content_indx);
        for(var j = 0; j < rowdata.length; j++) {
            var newTr = s.insertRow();

            newTd[0] = newTr.insertCell()
                newTd[0].innerText = _index++;

            newTd[1] = newTr.insertCell();
            if(rowdata[j].goodsName != undefined)
                newTd[1].innerText = rowdata[j].goodsName;

            newTd[2] = newTr.insertCell();
            if(rowdata[j].unitName != undefined)
                newTd[2].innerText = rowdata[j].unitName;

            newTd[3] = newTr.insertCell();
            if(rowdata[j].amount != undefined)
                newTd[3].innerText = rowdata[j].amount;

            newTd[4] = newTr.insertCell();
            if(rowdata[j].storeName != undefined)
                newTd[4].innerText = rowdata[j].storeName;

            newTd[6] = newTr.insertCell();

        }

    }

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一路追求匠人精神

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值