使用javascript打印网页选定区域 [英] Print Web Page Selected area using javascript

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

问题描述

我有一个asp.net页面,它有多个网格.

我只需要从该页面打印一个网格.

我该怎么做?

I have one asp.net page and it has multiple grids.

I have to print only one grid from that page.

How can I do that?

推荐答案



使用以下功能从网页上打印特定部分.

printContainer 是对象的ID,(它将仅打印对象的一部分)

Hi,

Use following function to print particular part from web page.

printContainer is a id of object, (it will print only part of the object)

function printPageContent(printContainer) {
    var DocumentContainer = document.getElementById(printContainer);
    var WindowObject = window.open('', "PrintWindow", "width=5,height=5,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
    WindowObject.document.writeln(DocumentContainer.innerHTML);
    WindowObject.document.close();
    WindowObject.focus();
    WindowObject.print();
    WindowObject.close();
}




如有任何疑问,请让我知道.

请提供"投票":thumbsup:如果有帮助,请提供"接受答案",如果这是正确的答案.:rose:

谢谢,
Imdadhusen




Please do let me know, if you have any doubt.

Please provide "Vote":thumbsup: if this would be helpful, and make "Accept Answer" if this would be correct answer.:rose:

Thanks,
Imdadhusen


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

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