[英]Web Page Print Preview
我正在創建一個在線申請表。 在首頁上,有名字,姓氏,電子郵件等表格輸入。 我想要的是,如果用戶填寫表格並單擊提交,我想向他顯示打印預覽頁面,其中包含用戶填寫的值...可以嗎? 我正在使用ASP.Net C#
如果可以使用jQuery,則此代碼很好
$(document).ready(function () {
window.print();
});
你可以看到這些
http://www.designplace.org/tutorials.php?page=1&c_id=27
如果可以使用javascript,請嘗試以下方法
<script type="text/javascript">
function CallPrint(strid) {
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '', 'letf=0,top=0,width=850,height=800,toolbar=0,scrollbars=1,status=0');
WinPrint.document.write('<html><head><title>Popup</title>')
WinPrint.document.write('</head><body>');
WinPrint.document.write('</body></html>');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
}
</script>
在頁面上點擊打印按鈕
<input id="btnPrint" type="button" value="Print" runat="server"
onclick="javascript:CallPrint('divPrint')"/>
並放置要在div中打印的控件
<div id="divPrint">
//Your controls
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.