您好,欢迎来到华佗养生网。
搜索
您的当前位置:首页javascript实现window.print()去除页眉页脚_javascript技巧

javascript实现window.print()去除页眉页脚_javascript技巧

来源:华佗养生网


打印时去除页眉页页脚 打印前加入下面代码即可 var HKEY_Root,HKEY_Path,HKEY_Key;

代码如下:

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

//设置页眉(为空) 根据你自己要设置的填入

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

HKEY_Key="footer";

//设置页脚(为空) 根据你自己要设置的填入

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

HKEY_Key="margin_bottom";

//设置下页边距(0) 根据你自己要设置的填入

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

HKEY_Key="margin_left";

//设置左页边距(0) 根据你自己要设置的填入

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

HKEY_Key="margin_right";

//设置右页边距(0)

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

HKEY_Key="margin_top";

//设置上页边距(8)

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

Copyright © 2019- huatuo7.cn 版权所有 湘ICP备2022005869号-9

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务