<HTML><HEAD><TITLE>关于用js打印网页</TITLE>
<META content="MSHTML 6.00.2900.3086" name=GENERATOR></HEAD>
<style media=print>
.Noprint{display:none;}<!--用本样式在打印时隐藏非打印项目-->
</style>
<BODY>
<DIV id=cnblogs_post_body>
<P>一、基本打印功能</P>
<P>二、在打印的页面中加入分页符</P>
<P>三、在打印页面中去除不需要的元素</P>
<P>四、设计打印页眉和页脚</P>
<P>五、用样式表调节页面边距</P>
<OBJECT id=wb height=0 width=0 classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 name=wb></OBJECT>
<input type=button name=button_print value="打印" οnclick="javascript:printit()" class="Noprint" />
<input type=button name=button_setup class="Noprint" value="打印页面设置" οnclick="javascript:printsetup();"/>
<input type=button name=button_show class="Noprint" value="打印预览" οnclick="javascript:printpreview();"/>
<input type=button name=button_fh class="Noprint" value="关闭" οnclick="javascript:window.close();"/>
<input id="abc" class="Noprint" class="Noprint" type=button name=print value="打印本页面" onClick="javascript:printit()">
<font class="Noprint">隐藏的文字</font>
</DIV>
<script language="javascript">
function printsetup(){
// 打印页面设置
wb.execwb(8,1);
}
function printpreview(){
// 打印页面预览
wb.execwb(7,1);
}
function printit()
{
if (confirm('确定打印吗?')) {
wb.execwb(6,6)
}
}
</script>
</BODY></HTML>