1<html>
2<head>
3<title>New Document </title>
4<meta content="EditPlus" name="Generator"/>
5<meta content="YC" name="Author"/>
6<script language="VBScript">
7dim hkey_root,hkey_path,hkey_key
8hkey_root="HKEY_CURRENT_USER"
9hkey_path="\Software\Microsoft\Internet Explorer\PageSetup" //IE打印设置的注册表地址
10
11function pagesetup_null()
12on error resume next
13Set RegWsh = CreateObject("WScript.Shell")
14hkey_key="\header"
15RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"" //页眉
16hkey_key="\footer"
17RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"" //页脚
18hkey_key="\margin_left"
19RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1" //键值设定--左边边界
20hkey_key="\margin_top"
21RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1"
22hkey_key="\margin_right"
23RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1"
24hkey_key="\margin_bottom"
25RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1"
26end function
27'//
28
29function pagesetup_default()
30on error resume next
31Set RegWsh = CreateObject("WScript.Shell")
32hkey_key="\header"
33RegWsh.RegWrite hkey_root+hkey_path+hkey_key ,"&w&b页,&p/&P" //页数-
34hkey_key="\footer"
35RegWsh.RegWrite hkey_root+hkey_path+hkey_key ,"&u&b&d" //网址,日期等信息
36end function
37</script>
38</head>
39<body>
40<table align="center" border="2" cellpadding="1" cellspacing="1" id="tb1" width="100%">
41<tr>
42<td>
43<br/>
44<br/>
45<br/>
46<p align="center">
47<input onclick="pagesetup_null()" type="button" value="Clean"/> <input onclick="pagesetup_default()" type="button" value="Reset"/><br/>
48</p>
49</td>
50</tr>
51</table>
52</body>
53</html>
除了以上键值以外还有
duplex
orientation
paper_size
paper_source
printer
注意:上面对页边距的设置为:1,实际设置值为25.4。