一个模式弹出的打印内容 [英] Print contents of a modal popup

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

问题描述

我有示出的项目的列表的应用程序。

I have an application that shows a list of items.

用户可以点击一个项目,看到一个模式弹出(居中DIV,使用JavaScript显示),其详细信息。我需要有上弹出一个按钮,将允许用户打印出模式弹出的内容仅

The user can click on an item and see its details in a modal popup (centered DIV, shown using JavaScript). I need to have a button on that popup that will allow the user to print out the contents of the modal popup only.

这是一个需要在只有IE7 +工作的内部应用程序。当用户点击模式弹出的打印按钮项的状态被更改为印刷(内部业务的原因......)。

This is for an internal application that needs to work in IE7+ only. When the user clicks the print button on the modal popup the state of the item gets changed to "printed" (for internal business reasons...).

我使用ASP.NET和 ASP.NET AJAX控件工具包ModalPopupExtender ,但我猜测,该技术来实现,这将是浏览器为中心,和服务器技术无关。

I am using ASP.NET and the ASP.NET AJAX Control Toolkit ModalPopupExtender, but I am guessing that the technique to achieve this will be browser-centric, and server technology agnostic.

推荐答案

您可以添加一个NOPRINT类名称一个div包装的一切你不想打印。

You could add a 'noprint' class name to a div wrapping everything you do not wish to print.

如果你也想在用户presses的打印按钮主网页是没有打印对话框,您可以添加类名称到包装DIV后取出类名。

If you also want the main page to be printable without the dialog you can add class name to the wrapper DIV when the user presses the PRINT button and remove the class name after.

@media print {
.noprint {
 display:none
}
}

这篇关于一个模式弹出的打印内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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