JavaScript print preview

后端 未结 10 1352
梦毁少年i
梦毁少年i 2020-12-28 19:46

How can I see print preview of my invoice generated from website. If I print with the script

print this page         


        
10条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 20:32

    Addressing the following part of your question:

    in the print "print this page also printed .

    How can I hide it?

    Create a new stylesheet (in this example, I've named it "print.css") and include it in your HTML as follows:

    
    

    Note the media="print"—this means the stylesheet will only be used when printing the page.

    Next assign a class to your element so that we can reference it in CSS:

    Print this Page
    

    Finally, in your CSS file, include the following rule:

    .noPrint {
        display: none;
    }
    

    Now the "Print this Page" link shouldn't appear in the printed version of your page.

    Steve

提交回复
热议问题