[英]Print button on a page which prints another page
我有一个名为order的页面,其中有“打印”按钮。 在单击打印时,我要打印另一个名为print_this的页面。
<div class="actions">
<%= f.submit 'Place order', class: 'btn btn-primary' %>
<%= f.submit 'Print', class: 'btn btn-primary' %>
</div>
所以说按钮位于以下URL: http://localhost:3000/o/p
所以在单击打印时,我想打开http://localhost:3000/orders/1
,即直接弹出打印。
请帮忙。
使用打印按钮创建超链接,该按钮将打开http://localhost:3000/orders/1?print=true
页面,并在orders
页面中编写js代码以检查传递的参数。 如果URL触发window.print()
存在print=true
参数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.