divforprint.style.page-break-after="";

解决方案 »

  1.   

    If I set divforprint.style.page-break-after to "", there will be no page break for all the <DIV> </DIV> section. I only want to take the page break for last <DIV> </DIV> section.
      

  2.   

    try sth likevar o=document.getElementsByTagName("DIV");
    o[o.length-1].removeNode(true);
      

  3.   

    Thanks, it is a good idea. But "o[o.length-1].removeNode(true)" will remove the whole last <DIV> </DIV> section.Is there a method to get Page Break tag ? If so, it is possible to remove last Page Break.
      

  4.   

    <html>
    <head>
    <title>emu</title>
    <style>
    @media print{.onlyShow{display:none}}
    </style>
    <SCRIPT LANGUAGE="JavaScript" defer>
    <!--
    var e = document.getElementsByTagName("DIV");
    for (var i=0;i<e.length-1;i++)
    e[i].style.pageBreakAfter="always"
    function preView(){try{WB.ExecWB(7,1)} catch(e){alert("您的浏览器不支持打印预览功能")}
    }//-->
    </SCRIPT></head>
    <body>
    <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0 VIEWASTEXT></OBJECT>
    <DIV>test1</DIV>
    <DIV>test2</DIV>
    <DIV>test3</DIV>
    <DIV>test4</DIV>
    <DIV>test5</DIV>
    <button onclick="preView()" class="onlyShow">test</button>
    </body>
    </html>