打印div内容


打印订单

javascript:printDiv();



<style>
    table {font-size:9pt;
        LINE-HEIGHT: 150%;
    }
    td  {font-size:9pt;
        LINE-HEIGHT: 150%;
    }

    .text-center {
        text-align: center;
    }
    .table-bordered {
        border: 1px solid #ddd;
    }
    .table {
        width: 100%;
        max-width: 100%;
        margin-bottom: 20px;
    }

    .table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td {
        border-top: 0;
    }
    > thead > tr > td {
          border-bottom-width: 2px;
      }
    .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
        border: 1px solid #ddd;
    }
    .text-right {
        text-align: right;
    }
    .table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td {
        padding: 8px;
        line-height: 1.42857143;
        vertical-align: top;
        border-top: 1px solid #ddd;
    }
    td, th {
        padding: 0;
    }
style>
<div style="page-break-after: always;">
    <h1 class="text-center">订单信息h1>
    <table class="table table-bordered">
        <thead>
        <tr>
            <td style="width: 50%;">发送自td>
            <td style="width: 50%;">订单详情td>
        tr>
        thead>
        <tbody>
        <tr>
            <td><address><strong>必带社区助手strong><br>北京市海淀创业大街3address>
                <b>电话:b> 123456789<br>
                <b>E-Mailb> <br>
                <b>网址:b> <a href="">a>
            td>
            <td style="width: 50%;">
                <b>下单日期:b> 2017-02-07<br>
                <b>订单号:b> 201702071145017310<br>
                <b>支付方式:b> 其他<br>
                <b>配送方式:b> 申通物流<br>
                <b>用户备注:b> <br>
            td>
        tr>
        tbody>
    table>
    <table class="table table-bordered">
        <thead>
        <tr>
            <td colspan="4"><b>收货信息b>td>
        tr>
        <tr><td>收件人td><td>联系电话td><td>收货地址td><td>邮编td>tr>
        thead>
        <tbody>
        <tr>
            <td>张谷泉td>
            <td>13512345678td>
            <td>广东省  深圳市  龙岗区  五和大道五和商业广场2017td>
            <td>td>
        tr>
        tbody>
    table>
    <table class="table table-bordered">
        <thead>
        <tr>
            <td><b>商品名称b>td>
            <td><b>状态b>td>
            <td><b>规格属性b>td>
            <td><b>数量b>td>
            <td><b>单价b>td>
            <td class="text-right"><b>小计b>td>
        tr>
        thead>
        <tbody>
        <tr>
            <td>华为(HUAWEIM2 10.0 平板电脑 WiFi 月光银td>
            <td>
                未发货                    td>
            <td>尺寸:7寸及以下 内存:16G 颜色:银白色td>
            <td>1td>
            <td>2000.00td>
            <td class="text-right">0.00td>
        tr>
        tbody>
        <tfoot>
        <tr><td colspan="5" class="text-center"><input class="btn btn-default noprint" type="submit" οnclick="window.print();" value="打印">td>tr>
        tfoot>
    table>
div>
<SCRIPT language=VBScript>
dim hkey_root,hkey_path,hkey_key
hkey_root="HKEY_CURRENT_USER"
hkey_path="\Software\Microsoft\Internet Explorer\PageSetup"
'//设置网页打印的页眉页脚为空
function pagesetup_null()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
end function
'//设置网页打印的页眉页脚为默认值
function pagesetup_default()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P"
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d"
end function
SCRIPT>

你可能感兴趣的:(前端)