JavaScript implements print, print preview, print Setup _javascript tips

Source: Internet
Author: User

WebBrowser is an IE-built browser control that requires no user downloads.

One, WebBrowser control

<object id= ' WebBrowser ' width=0 height=0 classid= ' clsid:8856f961-340a-11d0-a96b-00c04fd705a2 ' ></object >

Second, the Webbrowder control method//Print

WEBBROWSER1.EXECWB (6,1);

Print settings

WEBBROWSER1.EXECWB (8,1);

Print Preview

WEBBROWSER1.EXECWB (7,1);

There are other uses for this component, as listed below:

WEBBROWSER.EXECWB (1,1) turns on WEB.EXECWB (2,1) closes all the IE windows now and opens a new window WEB.EXECWB (4,1)

Save Web page WEB.EXECWB (6,1) print WEB.EXECWB (7,1) Print preview WEB.EXECWB (8,1)

Print Page Setup WEB.EXECWB (10,1)

View Page Properties WEB.EXECWB (15,1)

Seems to be withdrawn, pending confirmation WEB.EXECWB (17,1)

Full selection WEB.EXECWB (22,1) Refresh WEB.EXECWB (45,1)

Close the form without prompting but the print will print out the entire page, there is something printed on the page, we sometimes just need to print data tables, then we will write a style:

Hide the parts that you don't want to print: style: <style type= "Text/css" media=print>. Noprint{display:none} </style>

Then use the style to: <p class= "noprint" > where no printing is needed </p>

The code is as follows:

Copy Code code as follows:

<script language= "JavaScript" > Function Printsetup () {//Print Page Setup WB.EXECWB (8,1);} function PrintPreview () {// Print Page Preview
WB.EXECWB (7,1);
}
function PrintIt () {if (confirm) (' OK to print? ')} {WB.EXECWB (6,6)}} </script>
<object classid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT> <input Type=button name=button_print value= "print" class= "noprint" onclick= "Javascript:printit ()" > <input type= Button name=button_setup value= "Print page Setup" class= "noprint" onclick= "Javascript:printsetup ();" > <input type=button name=button_show value= "Print preview class=" noprint "onclick=" Javascript:printpreview (); " >

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.