var HKEY_RootPath="HKEY_CURRENT_USER//Software//Microsoft//Internet Explorer//PageSetup//";
function PageSetup_del(){
try{
var WSc=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,"");
HKEY_Key="footer";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,"");
}catch(e){}
}
function PageSetup_set(){
try{
var WSc=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,"&w&b页码,&p/&P");
HKEY_Key="footer";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,"&u&b&d");
}catch(e){}
}
<object id="WebBrowser" classid="ClSID:8856F961-340A-11D0-A96B-00C04Fd705A2" width="0" height="0">
</object>
<table width="647" align="center">
<tr align="center" bgcolor="#FFFFFF">
<td height="27" colspan="3" align="right">
<a href="#" onClick="PageSetup_del()">清空页眉页脚</a><a href="#" onClick="PageSetup_set()"> 恢复页眉页脚 </a>
<a href="#" onClick="document.all.WebBrowser.Execwb(7,1)">打印预览</a>
<a href="#" onClick="document.all.WebBrowser.Execwb(6,1)">打印</a>
<a href="#" onClick="document.all.WebBrowser.Execwb(6,6)">直接打印</a>
<a href="#" onClick="document.all.WebBrowser.Execwb(8,1)">页面设置</a>
</td>
</tr>
</table>