如何在asp.net中打印使用javascript的html的一部分 [英] how to print part of html for using javascript in asp.net
本文介绍了如何在asp.net中打印使用javascript的html的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尊敬的先生,
我对如何使用Java脚本打印html页面的一部分"有疑问吗?
现在我已经将整页(HTML)打印成功打印了,但是,
如何打印html的一部分?
通过mohan
Dear sir,
I have doubt for ''how to print part of html page using java script'' ?
now i have whole page(HTML) print is successfully printing But,
How to print part of html????
By mohan
推荐答案
尝试以下操作:
使用JavaScript HTML打印页面的一部分
使用CSS HTML打印页面的一部分
让我知道你的结果.
享受:)
Try the following:
HTML print part of page by using JavaScript
HTML print part of page by using CSS
Let me know your result.
Enjoy :)
为打印介质创建样式表,并隐藏您不想打印的部分
Create a stylesheet for the print media and hide the sections you don''t want to be printed
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
print.css
print.css
<style>
.noprint
{
display: none;
}
</style>
将您的代码放在特定的div或面板中,并使用该控件的ID进行调用,这将打印您的html页面的一部分.
Put your code in particular div or panel and call using id of that control this will print part of your html page.
<script language="javascript" type="text/javascript">
function Clickheretoprint() {var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting += "scrollbars=yes,width=650, height=600, left=100, top=25";
var content_vlue = document.getElementById('<%=dvPrintXL.ClientID %>').innerHTML;
var docprint = window.open("", "", disp_setting);
docprint.document.open();
docprint.document.write('<html><head><title>Print Page</title>');
docprint.document.write('</head><body><center>');
docprint.document.write(content_vlue);
docprint.document.write('</center></body></html>');
docprint.print();
docprint.document.close();
docprint.focus();
希望对您有帮助.
如果有帮助,请不要忘记将其标记为答案. :)
Hope this will help you.
Don''t forget to mark as answer if it helps. :)
这篇关于如何在asp.net中打印使用javascript的html的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文