在要打印强行分页的地方加上:

<P class=normal style="PAGE-BREAK-BEFORE: always">&nbsp;</P>

即可. 解释如下:

page-break-before版本:CSS2  兼容性:IE4+ 继承性:无
语法:
page-break-before : auto | always | avoid | left | right | null
取值:

auto :  假如需要在对象之前插入页分割符
always :  始终在对象之前插入页分割符
avoid :  未支持。避免在对象之前插入页分割符
left :  未支持。在对象之前插入页分割符直到它到达一个空白的左页边
right :  未支持。在对象之前插入页分割符直到它到达一个空白的右页边
null :  空白字符串。取消页分割符设置

 

 

二 是实现导出,打印,页面设置,打印预览的功能

<object id="WebBrowser" style="z-index: 104; left: 624px; width: 0px; position: absolute;
            top: 160px; height: 0px" height="112" width="77" classid="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"
            viewastext>
        </object>
          <div id="btn" style="text-align: center; width: 90%; margin-bottom: 5px">
          <button class="input-button" onclick="document.execCommand('saveas','','巡检单.html');"
                style="width: 80px; height: 20px" type="button">导出</button>
              &nbsp;<input class="input-button" onclick="btn.style.display='none';document.all.WebBrowser.ExecWB(6,6);btn.style.display='block';"
                    type="button" value="打 印" style="width: 80px; height: 20px" id="Button1">
                <input class="input-button" onclick="btn.style.display='none';document.all.WebBrowser.ExecWB(8,1);btn.style.display='block';"
                    type="button" value="页面设置" style="width: 80px; height: 20px">
                <input class="input-button" onclick="btn.style.display='none';document.all.WebBrowser.ExecWB(7,1);btn.style.display='block';"
                    type="button" value="打印预览" style="width: 80px; height: 20px">
            </div>

posted on 2010-08-05 10:35  挑战自我  阅读(2481)  评论(0编辑  收藏  举报