1. media= "Print" CSS to control the style that refers to media print in the file testprint.html to be printed, indicating that the style works when printing
The code is as follows: <link href= "/style/print.css" rel= "stylesheet" type= "Text/css" media= "print" > /style/ PRINT.CSS file code is as follows:. Noprint{display:none;} Use the style in the print.css in the testprint.html, can not see the effect when browsing the Web page, but it will work when printing, as the following paragraph, add noprint, still be realistic in the browser, but the print time does not show: Code as follows: <div class= "noprint" > <input type= "button" onclick= "Window.print ();" value= "Print this page"/> </div> Of course print.css inside the style you can write casually, change color AH (color image in black and white printer effect is not good, can use another style printing), the font of anything can, casually play--------------------------------------------------- -------------- 2. Use JavaScript to control because of this reason, some people may not be very skilled CSS, some people javascript compared to cow X, sometimes JavaScript is also a good choice code as follows: <script Type= "Text/javascript" > <!-- //automatically perform Window.onbeforeprint = function () { $ ("#test") before printing . Hide (); } //automatically executes Window.onafterprint = function () { $ ("#test") after printing. Show (); } //--> </script> <div id= "tEST "> This text will not be printed </div> printing, will call the Window.onbeforeprint function, then you can play, with your ingenuity to the HTML to reconstruct the side, and then print. Of course, after printing the general also want to get back, is the Window.onafterprint function ------------------------------------------------------------ --- tips: Note that printing we all know is window.print (), in fact, can also print frames, such as window.top.centerFrame.MainFrame.print ();