Print the full technical version of the web

Source: Internet
Author: User
Some people often ask questions about Printing web pages, although many of them know window. print () can implement the printing function, but the function is not completely enough. The following example will show you how to implement the complete printing Control Technology:
<HTML>
<Head>
<Script language = "JavaScript">
<! --
DA = (document. All )? 1: 0
Window. onerror = handle_error
Function handle_error ()
{
MSG = "\ n no Dongdong print. \ n if you want to print this page ,"
MSG + = "and \ n click the print button on the toolbar ."
Alert (MSG)
Return true;
}
// -->
</SCRIPT>
<Script language = "VBScript">
Sub print
Olecmd = 6' print command
Oleparam = 1
On Error resume next
Printit. execwb olecmd, oleparam
If err. Number <> 0 then
If Da Then 'ie4 user will exit Printing
Alert "Printing failed ."
The user of else 'ie3 will execute handle_error to handle the error.
Handle_error
End if
End if
End sub
</SCRIPT>
</Head>
<Body>
<Form>
<Input type = button value = "print" onclick = "window. Print ();">
</Form>
<Object ID = "printit"
Width = 0 Height = 0
Classid = "CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2">
</Object>
</Body>
</Html>

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.