. NET page specify how to print the area _ practical tips

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.