日期:2014-05-18  浏览次数:20651 次

页面打印相关问题

1、怎么去掉页眉,页脚
      打印出来页眉显示页码,页脚显示程序名和日期。
      现在想去掉,不知道有没有办法。
2、第一张横着打印,第二张竖着打印
      这个怎么控制?

谢谢!

------解决方案--------------------
1.去掉打印时的页眉页脚

以下是引用片段:

<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 Wsh=new ActiveXObject( "WScript.Shell ");
HKEY_Key= "header ";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key, " ");
HKEY_Key= "footer ";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key, " ");
}
catch(e){}
}
//设置网页打印的页眉页脚为默认值
function PageSetup_Default()
{
try
{
var Wsh=new ActiveXObject( "WScript.Shell ");
HKEY_Key= "header ";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key, "&w&b页码,&p/&P ");
HKEY_Key= "footer ";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key, "&u&b&d ");
}
catch(e){}
}
</script>
<input type= "button " value= "清空页码 " onclick=PageSetup_Null()>
<input type= "button " value= "恢复页码 " onclick=PageSetup_Default()>
------解决方案--------------------
1)ie的文件-〉页面设置-〉讲里面的页眉和页脚里面的东西都去掉,打印就不出来了.
(2) <HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= "YC ">
<script language= "VBScript ">
dim hkey_root,hkey_path,hkey_key
hkey_root= "HKEY_CURRENT_USER "
hkey_path= "\Software\Microsoft\Internet Explorer\PageSetup "
'//设置网页打印的页眉页脚为空
function pagesetup_null()
on error resume next
Set RegWsh = CreateObject( "WScript.Shell ")
hkey_key= "\header "
RegWsh.RegWrite hkey_root+hkey_path+hkey_key, " "
hkey_key= "\footer "
RegWsh.RegWrite hkey_root+hkey_path+hkey_key, " "
end function
'//设置网页打印的页眉页脚为默认值
function pagesetup_default()
on error resume next
Set RegWsh = CreateObject( "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 "
end function
</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>