一个JS修改IE属性的问题
各位高手
一个JS修改IE属性的问题,如果能有其他更好的方法,解决以下这一问题,请指点指点,谢谢!!
我现在需要调用IE的打印功能,调用是没有问题的,但打印出来的报表上
总是会显示:报表的页脚,页眉
我不需要页脚,页眉的显示,但是又不想通过页面设置这个界面去取消,
需要通过JAVA,或者JS的处理去掉页脚和页眉
不知道是否有方法实现?
我用以下方法尝试了,但没有起作用:
请高手帮忙看看,谢谢:
<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, " ")
}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){}
}
pagesetup_null();
</script>
</HEAD>
------解决方案-------------------- <object id= "factory " viewastext style= "display:none " classid= "clsid:1663ed61-23eb-11d2-b92f-008048fdd814 " codebase= "ScriptX.cab#Version=6,2,433,14 "> </object>
<script language= "javascript ">
factory.printing.header = " "
factory.printing.footer = " "
window.print();
</script>
------解决方案--------------------把注释去掉
<script language= "JavaScript ">
var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root= "HKEY_CURRENT_USER ";
HKEY_Path= "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\ ";
/*
//设置网页打印的页眉页脚为空
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){}
//设置网页打印的页眉页脚为默认值
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>