打印另一页的页面上的打印按钮

时间:2014-12-23 05:38:32

标签: javascript css ruby-on-rails twitter-bootstrap

我有一个名为order的页面,其中有Print按钮。点击打印我要打印另一个名为print_this的页面。

 <div class="actions">
  <%= f.submit 'Place order', class: 'btn btn-primary' %>
  <%= f.submit 'Print', class: 'btn btn-primary' %>
</div>

所以说按钮位于以下网址:http://localhost:3000/o/p所以点击打印我要打开http://localhost:3000/orders/1,即应该弹出直接打印。

请帮忙。

1 个答案:

答案 0 :(得分:1)

使用打印按钮制作超链接,打开http://localhost:3000/orders/1?print=true页面并在orders页面中编写js代码以检查传递的参数。如果网址触发器print=true

中存在window.print()参数
相关问题