JS printing function

Source: Internet
Author: User
1. window. print mode: jsp page printing button: & lt; inputtype & quot; button & quot; value & quot; print & quot; onclick & quot; print (); & quot; & gt; in js: functionprint () {window. print (); in the style, set the hide button to print 1. window. print mode:
Jsp page printing button:
 
Js:
Function print (){
Window. print ();
In the style, set the hide button to print:

2. WebBrowser Control Mode
WebBrowser is a browser control built in IE, which does not need to be downloaded by users.
I. WebBrowser Control
  
2. WebBrowder Control Method
// Print
WebBrowser1.ExecWB (6, 1 );
// Print settings
WebBrowser1.ExecWB (8, 1 );
// Print and preview
WebBrowser1.ExecWB (7,1 );
There are other usage examples of this component:
WebBrowser. ExecWB () Open
Web. ExecWB () Close all existing IE Windows and open a new window
Web. ExecWB () save Web Page
Web. ExecWB (6, 1) Printing
Web. ExecWB (7,1) print and preview
Web. ExecWB (8, 1) Printing page settings
Web. ExecWB () view page properties
Web. ExecWB () seems to be undo, to be confirmed
Select all Web. ExecWB ()
Web. ExecWB (22, 1) Refresh
Web. ExecWB () Close form no prompt
However, printing prints the entire page, and prints out anything on the page. Sometimes we only need to print the data table, and then we need to write a style: hide the part that you do not want to print:
Style content:

Then you can use the style:

No printing required


The Code is as follows:
Related Article

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.