1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 打印网页去掉页眉和页脚

打印网页去掉页眉和页脚

时间:2022-05-07 22:52:41

相关推荐

打印网页去掉页眉和页脚

方式一:

如果你使用的是IE6以及以前的版本,可以使用这个方法

打开浏览器文件->页面设置

在弹出的页面设置对话框中,将页眉输入框中的"&w&b页码,&p/&P"清空则标题信息就不打印了

只去掉&w&b,则只显示页码

将页脚输入框中的"&u&b&d"清空就可以了。

只去掉&u,则下面还会显示打印日期,而不显示网址。

方式二:

print打印部分网页,且去掉页眉、页脚 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gbk" /><title> </title><link rel="stylesheet" type="text/css" id="css" href="/orumdata/cache/style_2.css" /><Script language="JavaScript"> var hkey_root,hkey_path,hkey_keyhkey_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,"") ;}catch(e){}} function doPrint(){PageSetup_Null() ;var str = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head>';str += '<meta http-equiv="Content-Type" content="text/html; charset=gbk" />';str += '<title>'+document.title+'</title>';str += '<link rel="stylesheet" type="text/css" href="/orumdata/cache/style_2.css"/>';str +='</head>';str +='<body οnlοad="window.print()">'+document.getElementByIdx("printarea").innerHTML + '</body></html>';document.write(str);document.close(); }</script></head><body><div id="printarea"> 要打印的部分 </div> <input name="bt" type="button" value="打印" οnclick="doPrint();" /></body></html> 打印整个网页,不显示页面、页脚 test page print<br>xxxxxxxxxxx<br>yyyyyyyyyyyyyy<br>kkkkkkkkkkkk<br> <Script language="JavaScript"> var hkey_root,hkey_path,hkey_keyhkey_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,"") ;}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){}} // 打印function PrintPage(){PageSetup_Null() ;window.print() ;PageSetup_Default() ;} </Script><a href="#" onClick="PrintPage();">Print Page</a>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。