[英]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.