打印网页的特定区域 [英] Print a purticular area of webpage

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

问题描述

Hai,我如何打印网页的轴心区域(面板1)?您能帮我吗?

解决方案

 <  脚本    ="  文本/javascript" 语言  > javascript"  > 
    函数printdiv()
    {
    var divToPrint = document.getElementById('<% = PanelId.ClientID %> ');
    var newWin = window.open('AdminInvestments.aspx','PrintWindow');
    newWin.document.open();
    newWin.document.write('<   html  >  <   body    加载  ="  > '+ divToPrint.innerHTML +'<  /body  >  <  /html  > ');
    newWin.document.close();
    setTimeout(function(){newWin.close();},10);
    }



调用此javascript函数,在其中单击所需按钮...如下所示

<   a     ="  #" önclick  > javascript:printdiv ();" 样式  颜色:蓝色" "><  /a  >  


Hai, How can I print a purticular area(Panel1) of my webpage?can you help me

解决方案

<script type="text/javascript" language="javascript">
    function printdiv()
    {
    var divToPrint=document.getElementById('<%=PanelId.ClientID %>');
    var newWin=window.open('AdminInvestments.aspx','PrintWindow');
    newWin.document.open();
    newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
    newWin.document.close();
    setTimeout(function(){newWin.close();},10);
    }



call this javascript function in which button click you want ...like below

<a href="#" önclick="javascript:printdiv();" style="color:Blue">Print</a>


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

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