Javascript Implementation of window. print () to remove the header and footer _ javascript tips-js tutorial

Source: Internet
Author: User
This article mainly introduces the implementation of window in javascript. print () the method for removing the header and footer and the setting skills of each parameter. If you need to add the following code before removing the header and footer during printing, You Can var HKEY_Root, HKEY_Path, HKEY_Key;

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) according to your own settings

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

HKEY_Key = "footer ";

// Set the footer (empty) according to the settings you want to set

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

HKEY_Key = "margin_bottom ";

// Set the bottom margin (0) based on the settings you want to set

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

HKEY_Key = "margin_left ";

// Set the left margin (0) based on the settings 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 ");

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.