Asp.net: How can I print a web page without displaying the web page number?

Source: Internet
Author: User

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

 

 

 

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.