There are many ways to collect them by yourself
1. js implementation (local printing can be implemented)
<! -- Print Implementation 1: start --> <input id = "btnprint" type = "button" value = "print" onclick = "javascript: window. print (); "/> <! -- Mark unnecessary parts as class = "noprint" --> <style type = "text/CSS" Media = print>. noprint {display: None} </style> <P class = "noprint"> area not to be printed </P> <p> area to be printed </P> <! -- Print Implementation 1: end --> <! -- ************************* The code was updated ********** ****************** --> <! -- Print implementation 2: start --> <input id = "btnprint" type = "button" value = "print preview" onclick = Preview (1) /> <SCRIPT> function Preview (response) {If (Response <1036620.bdhtml###doc ument. body. innerhtml; // obtain the HTML code sprnstr = "<! -- Startprint "+ print +" --> "; // you can specify eprnstr =" <! -- Endprint "+ outputs +" --> "; // set the print end area prnhtml = bdhtml. substring (bdhtml. indexof (sprnstr) + 18); // obtain htmlprnhtml = prnhtml from the start code. substring (0, prnhtml. indexof (eprnstr); // obtain html?document.body.innerhtml=prnhtml###print({windowindow.doc ument. body. innerhtml = bdhtml;} else {window. print () ;}</SCRIPT> <p> XXXXX </P> <! -- Startprint1 --> content to be printed <! -- Endprint1 --> Add a print button onclick = Preview (1) <! -- Print implementation 2: end -->
2. Call windows underlying printing and report a security warning. It is not recommended (partial printing is not supported)
<HTML>
3. jquery implementation (supports local printing)
<SCRIPT type = "text/JavaScript" src = "jquery-1.4.2.min.js"> </SCRIPT> <SCRIPT type = "text/JavaScript" src = "jquery. printarea. JS "> </SCRIPT> <SCRIPT> $ (document ). ready (function () {$ ("input # biuuu_button "). click (function () {$ ("Div # myprintarea "). printarea ();});}); </SCRIPT> <input id = "biuuu_button" type = "button" value = "print"> </input> <Div id = "myprintarea"> ..... text printing ..... </div>