<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>New Document </title>
<style media="print">
.noprint
{
display: none;
}
</style>
<script type="text/javascript">
var hkey_root, hkey_path, hkey_key
hkey_root = "HKEY_CURRENT_USER"
hkey_path = "
http://www.cnblogs.com/zhongcj/admin/file://software//Microsoft//Internet Explorer\\PageSetup\\"
//设置网页打印的页眉页脚为空
function pagesetup_null() {
try {
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key = "header";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
hkey_key = "footer";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
} catch (e) { }
}
//设置网页打印的页眉页脚为默认值
function pagesetup_default() {
try {
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key = "header";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "&w&b页码,&p/&P");
hkey_key = "footer";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "&u&b&d");
} catch (e) { }
}
</script>
</head>
<body>
<object classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" id="WebBrowser"
width="0">
</object>
<center class="noprint">
<input name="Button" onclick="document.all.WebBrowser.ExecWB(1,1)" type="button"
value="打开"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(2,1)" type="button"
value="关闭所有"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(4,1)" type="button"
value="另存为"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(6,1)" type="button"
value="打印"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(6,6)" type="button"
value="直接打印"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(7,1)" type="button"
value="打印预览"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(8,1)" type="button"
value="页面设置"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(10,1)" type="button"
value="属性"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(17,1)" type="button"
value="全选"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(22,1)" type="button"
value="刷新"/>
<input name="Button" onclick="document.all.WebBrowser.ExecWB(45,1)" type="button"
value="关闭"/>
<input type="button" value="清空页码" onclick="pagesetup_null()"/>
<input type="button" value="恢复页码" onclick="pagesetup_default()"/>
</center>
<div>
要打印的内容</div>
</body>
</html>