javascript实现window.print()去除页眉页脚
作者:bea
打印时去除页眉页页脚 打印前加入下面代码即可 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.Shel
打印时去除页眉页页脚 打印前加入下面代码即可 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");
有用 | 无用
代码如下:
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");
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- javascript实现滑动解锁功能
- JavaScript中number转换成string介绍
- JavaScript中string转换成number介绍
- JavaScript中的object转换函数toString()与valueOf()介绍
- JavaScript中的object转换成number或string规则介绍
- javascript 事件处理示例分享
- JavaScript中的变量作用域介绍
- JavaScript中的变量定义与储存介绍
- JavaScript中的操作符==与===介绍
- jQuery中[attribute]选择器用法实例
- JavaScript中的比较操作符>、<、>=、<=介绍
- javascript 操作符(~、&、|、^、<<、>>)使用案例
- JavaScript中的逻辑判断符&&、||与!介绍
- JavaScript中的eval()函数使用介绍
- JSONP跨域GET请求解决Ajax跨域访问问题
- JavaScript中的异常捕捉介绍
- JavaScript中对象介绍
- JavaScript中用字面量创建对象介绍
- javascript设计模式之中介者模式Mediator