1. Set Internet Explorer
File> page Settings> clear the content of the header and footer.
2. Page code implementation Javascript
<! -- Startprint -->
// The part you want to print;
<! -- Endprint -->
<Div> <input tupe = botton name = "Print" value = "Print" onclick = "prit ()" </div>
// The tutorial is as follows:
<Script language = "javascript">
Function prit ()
{Bdhtml###doc ument. body. innerHtml;
Strstart = "<! -- Startprint --> ";
Strend = "<! -- End --> ";
Prnstr = bdhtml. substr (bdhtml, indexof (strstart) + 17)
Prnstr = bdhtml. substring (0, prnstr. indexof (strend ))
Required parameter Doc ument. body. innerHtml = prnstr;
Window. print ();
}
</Script>
Read the content to be printed in HTML, remove the header and footer, and print the removed html code.
3.
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<Meta name = "Generator" CONTENT = "EditPlus">
<Meta name = "Author" CONTENT = "YC">
<Script language = "VBScript">
Dim 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 ()
On error resume next
Set RegWsh = CreateObject ("WScript. Shell ")
Hkey_key = "\ header"
RegWsh. RegWrite hkey_root + hkey_path + hkey_key ,""
Hkey_key = "\ footer"
RegWsh. RegWrite hkey_root + hkey_path + hkey_key ,""
End function
// Set the page header and footer to the default value.
Function pagesetup_default ()
On error resume next
Set RegWsh = CreateObject ("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"
End function
</Script>
</HEAD>
<BODY>
<Br/> <p align = center>
<Input type = "button" value = "Clear page number" onclick = pagesetup_null ()> <input type = "button" value = "Restore page" onclick = pagesetup_default