通过脚本语言怎样去掉打印的页眉和页脚?

如题
---------------------------------------------------------------

 1<html><head>
 2<script language="VBScript">   
 3dim hkey_root,hkey_path,hkey_key   
 4hkey_root="HKEY_CURRENT_USER"   
 5hkey_path="\Software\Microsoft\Internet Explorer\PageSetup"   
 6'//设置网页打印的页眉页脚为空   
 7function pagesetup_null()   
 8on error resume next   
 9Set RegWsh = CreateObject("WScript.Shell")   
10hkey_key="\header"   
11RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""   
12hkey_key="\footer"   
13RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""   
14end function   
15'//设置网页打印的页眉页脚为默认值   
16function pagesetup_default()   
17on error resume next   
18Set RegWsh = CreateObject("WScript.Shell")   
19hkey_key="\header"   
20RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P"   
21hkey_key="\footer"   
22RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d"   
23end function   
24</script>
25</head>
26<body>
27<p align="center">
28<input onclick="pagesetup_null()" type="button" value="清空页码"/>
29<input onclick="pagesetup_default()" type="button" value="恢复页码"/>
30</p></body></html>

---------------------------------------------------------------

 1<html><head>
 2<script language="JavaScript">   
 3var hkey_root,hkey_path,hkey_key   
 4hkey_root="HKEY_CURRENT_USER"   
 5hkey_path="\\\Software\\\Microsoft\\\Internet Explorer\\\PageSetup\\\"   
 6//设置网页打印的页眉页脚为空   
 7function pagesetup_null(){   
 8try{   
 9var RegWsh = new ActiveXObject("WScript.Shell")   
10hkey_key="header"   
11RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")   
12hkey_key="footer"   
13RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")   
14}catch(e){}   
15}   
16//设置网页打印的页眉页脚为默认值   
17function pagesetup_default(){   
18try{   
19var RegWsh = new ActiveXObject("WScript.Shell")   
20hkey_key="header"   
21RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P")   
22hkey_key="footer"   
23RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&u&b&d")   
24}catch(e){}   
25}   
26</script>
27</head>
28<body>
29<p align="center">
30<input onclick="pagesetup_null()" type="button" value="清空页码"/>
31<input onclick="pagesetup_default()" type="button" value="恢复页码"/><br/>
32</p></body></html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus