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

JSP打印功能的小问题
我不想打印出页面的页眉的那个页码和页脚的内容,该怎样做呢?请指教!谢谢!

------解决方案--------------------
通过ie的页面设置进行设置。(firefox同样适用),如果需要控制客户端,需要调用一些控件修改客户端的注册表,不推荐。
------解决方案--------------------
parent.frames[ "main "].print();
------解决方案--------------------

function main_doPrint()
{
var str= " <html> ";
var article;
var css;
var strAdBegin= " <!--NEWSZW_HZH_BEGIN--> ";
var strAdEnd= " <!--NEWSZW_HZH_END--> ";
var strFontSize= '【 <A href= "javascript:doZoom(16) "> 大 </A> <A href= "javascript:doZoom(14) "> 中 </A> <A href= "javascript:doZoom(12) "> 小 </A> 】 '
var strdoPrint= "doPrint() ";
var strTmp;

css= " <style> "
+ ".18txt {font-family:宋体;font-size:18px;color:#000000; text-decoration:none;line-height:24px;} "
+ "td,.f12{font-size:12px} "
+ ".f24 {font-size:24px;} "
+ ".f14 {font-size:14px;} "
+ ".title14 {font-size:14px;line-height:130%} "
+ ".l17 {line-height:170%;} "
+ " </style> ";

str += css;
str += ' <meta http-equiv= "content-type " content= "text/html; charset=gb2312 "> ';
str += ' <title> '+document.title+ ' </title> ';
str += " <body bgcolor=#ffffff topmargin=0 leftmargin=1 marginheight=1 marginwidth=1 onLoad= 'window.print() '> ";
str += " <center> ";
str += " <table width=560 border=0 cellpadding=0 cellspacing=1 bgcolor=#EDF0F5> <tr> <td> ";

article=document.getElementById( 'article ').innerHTML;
if(article.indexOf(strAdBegin)!=-1){
str +=article.substr(0,article.indexOf(strAdBegin));
strTmp=article.substr(article.indexOf(strAdEnd)+strAdEnd.length, article.length);
}else{
strTmp=article
}
str += strTmp;
str += " </td> </tr> </table> ";
str += " <br> </CENTER> </TD> </TR> </TBODY> </TABLE> ";
str += " </center> ";
str += " </body> </html> ";
document.write(str);
document.close();
}

</script>