2013-12-07 4 views
0

, когда я нажимаю печать перенаправляет на печать в одном окне, таким образом, теряет первоначальный receipt.What я должен добавить ниже код, чтобы он открывался в новом окнеКак открыть печать в новом окне?

<div class="print_img"> 
    <button onclick="myFunction()"> 
     <div align="justify">Print</div> 
    </button> 
</div> 
<script> 
    function myFunction() { 
     window.print(); 
    } 
</script> 
<style> 
    @media print { 
     .print_img { 
      display:none; 
     } 
    } 

ответ

0
function myFunction() { 
    var thePopup = window.open('', "My Popup", "menubar=0,location=0,height=700,width=700"); 
    $('#popup-content').clone().appendTo(thePopup.document.body); 
    thePopup.print(); 
} 

Попробуйте изменить вашу функцию, как это

+0

это дает дает пустой всплывающее – user3067299

0

Попробуйте это:

var newWindow=window.open('','','width=200,height=100'); 
    newWindow.document.write("<p>Append here your text/html</p>"); 

    newWindow.document.close(); 
newWindow.focus(); 
newWindow.print(); 
newWindow.close(); 
Смежные вопросы