js 设置网页打印的页眉页脚和页边距
本人是用js写,代码如下:
function PageSetup_Null() {
try {
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, "0");
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, "8");
} catch(e) {
alert("不允许ActiveX控件");
}
}
ActiveXObject("WScript.Shell");这个对象无效,网上的方法我都试过了,都无效
function PageSetup_Null() {
try {
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, "0");
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, "8");
} catch(e) {
alert("不允许ActiveX控件");
}
}
ActiveXObject("WScript.Shell");这个对象无效,网上的方法我都试过了,都无效
...全文
相关推荐
js iframe 打印 打印预览 页眉页脚的设置
NULL 博文链接:https://guoliangheyuqin.iteye.com/blog/1664562
js 客户端打印html 并且去掉页眉、页脚的实例
print() 方法用于打印当前窗口的内容,支持部分或者整个网页打印。 调用 print() 方法所引发的行为就像用户单击浏览器的打印按钮。通常,这会产生一个对话框,让用户可以取消或定制打印请求。 win10下测试ie11、chrome、firefox、360、edge 都可以成功去掉页眉页脚; <!DOCTYPE html> <html> <head> <title>打印</title> <meta charset="utf-8"> <style> .printBox { width: 300px; height: 300px; border: 1px sol
WEB直接打印js源码
在js中真接设置打印页面,页眉,页脚,页边距。A4纸直接打印。
javascript编写基于chrome浏览器的打印程序,本例用来打印小票.zip
javascript js编写基于chrome浏览器的打印程序,本例用来打印小票.zip
js 前端打印demo
前端打印demo,非常好用,简单 ,方便,复用性好,一次


