Home  >  Article  >  Web Front-end  >  Javascript implements window.print() to remove headers and footers_javascript skills

Javascript implements window.print() to remove headers and footers_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:23:022687browse

Remove the header and footer when printing. Just add the following code before printing: var HKEY_Root,HKEY_Path,HKEY_Key;

Copy code The code is as follows:

HKEY_Root="HKEY_CURRENT_USER";

HKEY_Path="\Software\Microsoft\Internet Explorer\PageSetup\";

var head,foot,top,bottom,left,right;

var Wsh=new ActiveXObject("WScript.Shell");

HKEY_Key="header";

//Set the header (empty) Fill in the header according to what you want to set

Wsh.RegWrite(HKEY_Root HKEY_Path HKEY_Key,"");

HKEY_Key="footer";

//Set the footer (empty) Fill in according to what you want to set

Wsh.RegWrite(HKEY_Root HKEY_Path HKEY_Key,"");

HKEY_Key="margin_bottom";

//Set the lower page margin (0) and fill it in according to what you want to set

Wsh.RegWrite(HKEY_Root HKEY_Path HKEY_Key,"0");

HKEY_Key="margin_left";

//Set the left margin (0) and fill it in according to what you want to set

Wsh.RegWrite(HKEY_Root HKEY_Path HKEY_Key,"1");

HKEY_Key="margin_right";

//Set the right margin (0)

Wsh.RegWrite(HKEY_Root HKEY_Path HKEY_Key,"0");

HKEY_Key="margin_top";

//Set the top margin (8)

Wsh.RegWrite(HKEY_Root HKEY_Path HKEY_Key,"1");

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn