How to set the header and footer printed by IE

Source: Internet
Author: User

First, describe the problem:
By default, the printed content in the IE Print dialog box contains the header and footer.
View the page settings of IE, such as the header and footer in the picture on the right.

The following describes the meaning of & W & bpage & P of & P, & U & B & D.
& W-window title
& U-page address
& D-short date format, for example, 10/12/2006
& D-long date format, such as tursday, October 12,200 6
& T-12-hour time
& T-24-hour time
& P-page number
& P-total page number
&-That is &
& B-align the text before the symbol to the right
& B-align the text in the text drama before the first symbol, and align the text in the right end before the second symbol

Of course, you can manually delete the header and footer. If you just don't want to modify it yourself, you can force the modification using the following script:CopyCodeThe Code is as follows: 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 (){
Try {
VaR regwsh = new activexobject ("wscript. Shell ")
Hkey_key = "Header"
Regwsh. regwrite (hkey_root + hkey_path + hkey_key ,"")
Hkey_key = "footer"
Regwsh. regwrite (hkey_root + hkey_path + hkey_key ,"")
} Catch (e ){}
}

This is a bit embarrassing. It is used to modify the registry. Therefore, a dialog box is usually displayed.

If you click "yes", the header and footer are missing as you wish.

Next, what if we need to restore it?

CodeCopy codeThe Code is as follows: // set the page header and footer to the default value.
Function pagesetup_default (){
Try {
VaR regwsh = new activexobject ("wscript. Shell ")
Hkey_key = "Header"
Regwsh. regwrite (hkey_root + hkey_path + hkey_key, "& W & B page number, & P/& P ")
Hkey_key = "footer"
Regwsh. regwrite (hkey_root + hkey_path + hkey_key, "& U & B & D ")
} Catch (e ){}
}

Wscript. shell (Windows Script Host Runtime Library) is an object corresponding to c: \ windows \ system32 \ wshom. OCX, wscript. shell is a component used by the server system. Shell is the meaning of "shell". This object can perform common operations on the operating system shell, such as runningProgram, Read and write the registry, environment variables, and so on.
For more wscript applications, see http://www.jb51.net/article/21296.htm

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.