Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 16:23:02
Original
2686 people have browsed it

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");

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template