打印功能实现

<head id="Head1" runat="server">
  <object id="factory" style="display: none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
        codebase="smsx.cab" viewastext>
    </object>

    <script type="text/javascript">
     function PrintTable() {
            //$("#div_print").attr({"display":"display"});
            $("#div_print").hide();
            doprint();
        }
       
     function doprint() {
        factory.printing.header = "";
        factory.printing.footer = "";
        factory.printing.portrait = false; //portrait是指打印方向,设置为true就是纵向,false就是横向。
        factory.printing.leftMargin   = 5   
        factory.printing.topMargin   =   2   
        factory.printing.rightMargin   =   5   
        factory.printing.bottomMargin   =   2

        factory.DoPrint(false); //设置为false,直接打印
     }

    </script>

</head>

 

<body>

<div id="div_print" style="margin-top:20px; text-align:center; display:block;">
            <input onclick="PrintTable();" id="PrintHide" type="submit" class="btnSubmitChiH" value="打   印" />
     </div>
           

</body>

 

 

 

 

posted @ 2014-04-07 17:47  lengv10  阅读(145)  评论(0编辑  收藏  举报