打印网页 [英] print a web page

查看:94
本文介绍了打印网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi.i无法打印网页.我想在网页中创建一个按钮,然后单击该按钮即可打印页面.????????????

hi.i can''t print a web page.i want create a button in web page and when i click it,print page.????????????

推荐答案

使用此脚本
1)
use this script
1)
<script language="javascript" type="text/javascript">
                function CallPrint(strid) {
                    var prtContent = document.getElementById(strid);
                    var WinPrint = window.open('', '', 'letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
                    WinPrint.document.write(prtContent.innerHTML);
                    WinPrint.document.close();
                    WinPrint.focus();
                    WinPrint.print();
                    WinPrint.close();
                    prtContent.innerHTML = strOldOne;
                }
</script>



2)



2)

<div id="bill"></div>


//将打印内容.
3)


//the content will be printed .
3)

<asp:button id="BtnPrint" runat="server" text="Print" onclientclick="javascript:CallPrint('bill');" xmlns:asp="#unknown" />
</div>


您可以使用 window.print()(JavaScript)单击按钮即可打印网页.
You can use window.print() (JavaScript) to print a webpage on a button click.


查看链接以获取解释

http://www.javascriptkit.com/howto/newtech2.shtml [
check out the link for explanation

http://www.javascriptkit.com/howto/newtech2.shtml[^]


这篇关于打印网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆