IE print window. Print

Source: Internet
Author: User

Window. Print is a simple printing method in IE printing.

By default, window. Print prints the header and footer. You can use JavaScript to remove the header and footer.

 

Function doprint (){

/// Hide the content that does not need to be printed
Try
{
Pagesetup_null ();
}
Catch (E)
{
VaR errormsg = E. set message + "\ r" +: IE options-> Security-> Internet-> "+" ActiveX controls and ins "+" \ r "+" initialize and execute scripts for ActiveX controls that are not marked as scripts for security-> allow/prompt ";
Alert (errormsg );
Return;
}
Window. Print ();
}

 

</SCRIPT>

<SCRIPT type = "text/JavaScript" Language = "JavaScript">
VaR hkey_root, hkey_path, hkey_key;
Hkey_root = "HKEY_CURRENT_USER ";
Hkey_path = "\ Software \ Microsoft \ Internet Explorer \ pagesetup \\";
// Set the page header and footer to be empty.
Function pagesetup_null ()
{
VaR wsh = new activexobject ("wscript. Shell ");
Hkey_key = "Header ";
Wsh. regwrite (hkey_root + hkey_path + hkey_key ,"");
Hkey_key = "footer ";
Wsh. regwrite (hkey_root + hkey_path + hkey_key ,"");
Hkey_key = "margin_left"
Wsh. regwrite (hkey_root + hkey_path + hkey_key, "0"); // key value setting -- left boundary

Hkey_key = "margin_top"
Wsh. regwrite (hkey_root + hkey_path + hkey_key, "0"); // key value setting -- upper boundary

Hkey_key = "margin_right"
Wsh. regwrite (hkey_root + hkey_path + hkey_key, "0"); // key value setting -- Right Border

Hkey_key = "margin_bottom"
Wsh. regwrite (hkey_root + hkey_path + hkey_key, "0"); // key value setting -- bottom boundary
}

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.