我不需要打印整个页面 [英] I don't need to print whole page

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

问题描述

您好,先生,

我在按钮clientclick事件中使用此代码"javascript:print();",请告诉我只能打印特定页面的脚本,就像上面的代码正在打印整个页面一样.

我不需要正在打印的页面的背景.

在此先谢谢您

Hello Sir,

I am using this code "javascript:print();" in button clientclick event, kindly tell me the script that can print only particular page like the above code is printing the whole page.

I don''t need the background of the page that it is printing.

Thank you in advance

推荐答案

创建新的CSS让print.css
在页面中使用媒体= print
包含此CSS
Create a new css let print.css
include this css in your page with media = print

<link rel="stylesheet" type="text/css">
     href="print.css" media="print"></link>



在此CSS中,根据您的要求创建类并应用它
例如,这是CSS



In this css create class with your requirement and apply it
eg.this is css

.bc{background-color:red;}



print.css



print.css

.bc{background-color:white;}


现在


now

<div class="bc">
...your code
</div>


检查这些

易于打印的网页和CSS [易于打印的页面-自动化 [
Check these

Print-Friendly Web Pages and CSS[^]
Printer-Friendly Pages - Automating[^]


使用window.print时(这是您的工作) ,它所做的只是打开当前页面的打印对话框,允许用户选择要打印的页码等,它不允许您将好"与坏"分开,仅打印您想要的项目.

最简单的方法是创建一个单独的,易于打印的页面,然后进行打印.还有其他方法.但他们需要更多的思考和计划-Google可以帮助您找到有关的教程.
When you use window.print (which is what you are doing, all it does is open a print dialog for the current page, allowing the user to select the page number and so forth to print. It won''t allow you to separate the "good" from the "bad" and print only the items you want.

The simplest way is to create a separate, printer-friendly page, which you then print. There are other ways,. but they require a bit more thought and planning - Google can help you to find tutorials on that.


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

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