<HTML><HEAD>
<script language="JavaScript">
var hkey_root,hkey_path,hkey_key
hkey_root="HKEY_CURRENT_USER"
hkey_path="//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,"");
print();
}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");
print();
}catch(e){}
}
</script>
</HEAD>
<BODY><br/><br/><br/><br/><br/><br/><p align=center>
<input type="button" value="清空页码" onclick=pagesetup_null()>
<input type="button" value="恢复页码" onclick=pagesetup_default()><br/>
</p></BODY></HTML>
清除与恢复IE页眉页脚
本文介绍了一个简单的HTML页面,通过JavaScript脚本实现Internet Explorer浏览器中网页打印时页眉和页脚的清除及恢复默认设置的功能。该页面包含两个按钮:一个用于将页眉和页脚设置为空,另一个则恢复到默认的页码格式。
1万+

被折叠的 条评论
为什么被折叠?



