标题:网页打印上下边距问题
取消只看楼主
sncelpl
Rank: 1
等 级:新手上路
帖 子:87
专家分:0
注 册:2006-6-28
结帖率:86.67%
 问题点数:0 回复次数:0 
网页打印上下边距问题
<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>
这是代码怎么调整上下打印边距
搜索更多相关主题的帖子: var table style str document 
2022-07-15 14:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-509568-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.083131 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved