簡體   English   中英

使用javascript的打印功能打印彈出窗口

[英]Print the popup using print function of javascript

我有一個模式彈出窗口“ gatepass”。 當我單擊generate時,它會生成此Gatepass。 在此通行證中,我有兩個按鈕關閉並打印。 當我單擊“打印”按鈕時,我希望門禁打印而不是背景。 請指導我,我該怎么辦?

<html>
<head>
 <script src="js/calculateamt.js" type="text/javascript"></script>
      <link href="CSS/popup.css" rel="stylesheet" type="text/css">

</head>
<body>
   <fieldset id="gatepass" class="popup">
    <p align="center"><span style="size: 40px; font-size: 24px; alignment-adjust:middle">CASH RECIEPT</span></p>
    <table width="453" border="0" align="center" cellpadding="20px">
            <tr>
                <td width="188" height="51">RECIEPT NO : 
                    <label id="recno"><%=recieptno%></label></td>
                <td width="179">DATE : <label id="date"><%=date%></label></td>
            </tr>
            <tr>
                <td height="57">NAME : <label id="name" > <%=firstname%> <%=lastname%></label></td>
                <td>VILLAGE : <label id="village"> <%=vill%></label></td>
            </tr>
        </table>

        <p>&nbsp;</p>
        <table width="697" height="52" border="0" align="center" cellpadding="20px">
            <tr>
                <td width="205">AGREEMENT NO : <label id="agrno"> <%=agreno%></label> </td>
                <td width="149">LOT NO : <label id="lotno"><%=agreno%>/<%=bag%></label></td>
                <td width="151">BAGS : <label id="bags" ><%=bag%></label></td>
                <td width="174"> VEHICLE NO : <label id="vehicle"></label></td>
            </tr>
        </table>
        <p>&nbsp;</p>
        <table width="200" height="47" border="0" align="center" cellpadding="20px">
            <tr>
                <td> TOTAL AMOUNT : 
                    <label onloadstart="javascript:totalamt()" id="Totalamt" name ="total"></label></td>

            </tr>
        </table>
        <p align="center">
        <p align="center">
            <input type="button" name="Print" id="Print" value="PRINT" onClick="window.focus();window.print();">
            <input type="button" name="close" id="close" value="CLOSE" onClick = "closePopup();"  /> 

        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>

    </fieldset>

</body>
</html>

我建議您在打印樣式表上進行研究

http://www.webdesignerdepot.com/2010/01/10-tips-for-better-print-style-sheets/

<link rel="stylesheet" type="text/css" href="print.css" media="print" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM