Using CSS, define a. Noprint class, which will not be printed into this class.
Details are as follows:
Copy Code code as follows:
<style media=print type= "Text/css" >
. Noprint{visibility:hidden}
</style>
The content to be printed. Ha ha!
<p class= "noprint" > will not print the code here. </p>
<a href= "Javascrīpt:window.print ()" target= "_self" > Printing </a>
Second method: Specify the print Area
Put the content you want to print into a span or div and print it through a function.
Copy Code code as follows:
<span id= ' Div1 ' > put the content to be printed here </span>
<p> All content </p>
<div id= "Div2" >div2 content </div>
<a href= "Javascrīpt:printme ()" target= "_self" > Printing </a>
<scrīpt language= "Javascrīpt" >
function Printme ()
{
Document.body.innerhtml=document.getelementbyid (' Div1 '). innerhtml+ ' <br/> ' +document.getelementbyid (' div2 ') ). InnerHTML;
Window.print ();
}
</scrīpt>
If you want to print only a small portion of the entire page, it's best to use the second method.
The Third way: if you want to print page layout and the original Web page is very different, this approach.
The dot Print button pops up a new window, displays the content you want to print to a new window, calls the Window.print () method in a new window, and then automatically closes the new window.