编辑下面的代码:【加编码】
<html> <head> <script> function setPageBreak() { document.getElementById("footer").style.pageBreakAfter="always"; } </script> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> <p id="footer">This is a footer paragraph.</p> <button type="button" onclick="setPageBreak()">Set page-break after footer paragraph</button> <p>Click the button above and see the changes in print or print preview.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂