Cleverly implement hidden Web page elements that you don't want to print

Source: Internet
Author: User
web| Print | page <meta http-equiv=content-type content= "text/html; charset=gb2312 ">
<script language=javascript>
function PRINTPR ()//preview functions
{
document.all ("Qingkongyema"). Click ()//Remove headers, footers before printing
document.all ("Dayindiv"). style.display= "None"; Hide elements that you do not want to print out before printing (hide print and print preview two buttons in this example)
var olecmdid = 7;
var PROMPT = 1;
var WebBrowser = ' <object id= ' WebBrowser1 ' width=0 height=0 classid= ' CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 ' ></OBJECT> ';
Document.body.insertAdjacentHTML (' BeforeEnd ', WebBrowser);
WEBBROWSER1.EXECWB (Olecmdid, PROMPT);
webbrowser1.outerhtml = "";
document.all ("Dayindiv"). style.display= "";//After printing, display the element (display "print" and "Print Preview" two buttons to make it easier for others to print next time)
}

function printture ()//print functions
{
document.all (' Qingkongyema '). Click ()/Ibid.
document.all ("Dayindiv"). style.display= "None";/Ibid.
Window.print ();
document.all ("Dayindiv"). style.display= "";
}
function Dopage ()
{
LayLoading.style.display = "none";/Ibid.
}

</SCRIPT>

<script language= "VBScript" >
Dim Hkey_root,hkey_path,hkey_key
Hkey_root= "HKEY_CURRENT_USER"
Hkey_path= "\SOFTWARE\Microsoft\Internet Explorer\PageSetup"
'//Set page to print header and footer 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 footer as 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 background= "Images/background_01.gif" leftmargin=0
Topmargin=0 rightmargin=0 bottommargin=0 style= "Background-position:center 50%" >

<div align=center>

What you would like to print ...
</DIV>

<div align= "center" id= "Dayindiv" name= "Dayindiv" ><input "button" type= "tab" class= "Print" >
<input type= "button" class= "tab" value= "Print Preview" >
<input type= "hidden" name= "Qingkongyema" id= "Qingkongyema" class= "tab" value= "clear page number" >
<input type= "hidden" class= "tab" value= "Restore page number" >
</DIV>

</BODY>
</HTML>



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.