[英]Print popup window Javascript
I have a table that has input boxes and a pop up window that has information in it. 我有一个具有输入框的表,以及一个包含信息的弹出窗口。 I would like to be able to print the table data and include the popup information as well. 我希望能够打印表数据并包括弹出信息。 Is this possible. 这可能吗。 Quick example below. 下面的快速示例。
Javascript Java脚本
<script>
function divPrint() {
window.print();
}
</script>
HTML 的HTML
<div id="printable">
<table class="table">
<th>Option 1</th>
<th>Option 2</th>
<tr>
<td><input class="span6 text-center" type="text" id="cost1"></td>
<td><input class="span6 text-center" type="text" id="cost2"></td>
</tr>
</table>
<div class="popup" data-popup="popup">
<p>Need to print this as well</p>
</div>
</div>
Yes, you can. 是的你可以。
It generally involves setting the .popup
to display in the print view, using a css media query like @media print
. 通常,它涉及使用CSS媒体查询(如@media print
将.popup
设置为在打印视图中显示。
For example: 例如:
@media print {
.popup {
display:block !important;
}
}
If you try to print this page, you should see the popup as well: https://output.jsbin.com/mezalosazo 如果尝试打印此页面,则还应该看到弹出窗口: https : //output.jsbin.com/mezalosazo
Here's the version on jsbin if you want to edit it: https://jsbin.com/mezalosazo/edit?css,js,output 如果要编辑jsbin,请使用以下版本: https ://jsbin.com/mezalosazo/edit?css,js,output
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.