posts - 31,  comments - 31,  trackbacks - 0

如何控制你做的网页打印出来在一张纸上。
下面是我的解决方案:
要求:IE5。5以上。
将页面页面边距设置的“上下左右”都设为5;也可以设为0;
并将页面设为“纵向”。

然后再要打印的网页插入以下模板中(当然可以巧妙的嵌在ASP生成的网页上。):


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--CSS样式表插入到这里-------------------->

 

<!--------------------------------------->
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" width="740" height="1058">
  <tr>
    <td>
      <div id="content" style="position:absolute; z-index:1; left: 15; top: 15; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000">
<!--中间插入要缩印的内容------------------------->


<!-------------------------------------------------->
   </div>
    </td>
  </tr>
</table> 
<script>
//如果是横向,下面两个数值要改过来!变为:
//page_width=29*36.5
//page_height=20*37
page_width=20*37
page_height=29*36.5
zoom_width=page_width/document.all("content").scrollWidth
zoom_height=page_height/document.all("content").scrollHeight
if(zoom_width>zoom_height){
document.all("content").style.zoom=zoom_height
}
else
{
document.all("content").style.zoom=zoom_width
}
</script>
</body>
</html>

posted on 2006-09-20 11:44 小平 阅读(5394) 评论(0)  编辑  收藏 所属分类: web

只有注册用户登录后才能发表评论。


网站导航:
 
<2006年9月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用链接

留言簿(2)

随笔分类

随笔档案

framework

j2me

java

linux

web

其他

友情链接

素材

最新评论

阅读排行榜

评论排行榜