注册 登录
编程论坛 ASP技术论坛

网页打印上下边距问题

sncelpl 发布于 2022-07-15 14:11, 770 次点击
<SCRIPT language=JavaScript>
function 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>"
+"body{font-family:宋体}"
+"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 +='<p> </p><p> </p>';
//str += '<title>'+document.title+'</title>';
str += "<body bgcolor=#ffffff topmargin=5 leftmargin=5 marginheight=5 marginwidth=5 onLoad='window.print()'>";
str += "<center><table width=600 border=0 cellspacing=0 cellpadding=0><tr><td align=right valign=bottom></td></tr></table>";
str += "<table width=600 border=0 cellpadding=0 cellspacing=20 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></center>";
str += "</body></html>";
document.write(str);
document.close();
}
</SCRIPT>
<style>
<!--
table.MsoTableGrid
    {border:1.0pt solid windowtext;
    font-size:10.5pt;
    font-family:"Calibri","sans-serif";
    }
-->
</style>
这是代码怎么调整上下打印边距
只有本站会员才能查看附件,请 登录
0 回复
1