How can I pop-up a print dialog box using Javascript?

后端 未结 8 1328
闹比i
闹比i 2020-12-07 16:55

I have a page with a \"Print\" link that takes the user to a printer-friendly page. The client wants a print dialog box to appear automatically when the user arrives at the

相关标签:
8条回答
  • 2020-12-07 17:51
    window.print();  
    

    unless you mean a custom looking popup.

    0 讨论(0)
  • 2020-12-07 17:59

    I do this to make sure they remember to print landscape, which is necessary for a lot of pages on a lot of printers.

    <a href="javascript:alert('Please be sure to set your printer to Landscape.');window.print();">Print Me...</a>
    

    or

    <body onload="alert('Please be sure to set your printer to Landscape.');window.print();">
    etc.
    </body>
    
    0 讨论(0)
提交回复
热议问题