Copy codeThe Code is as follows:
<Script language = "JScript">
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) {alert (e. name + "" + e. message )}
}
// 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) {alert (e. name + "" + e. message )}
}
</Script>
<Body>
<Input type = "button" value = "Restore page number" onclick = pagesetup_default ()>
<Input type = "button" value = "Clear page number" onclick = pagesetup_null ()>
</Body>
</Html>