<!DOCTYPE html> <html> <body> <h2>window.print() 方法</h2> <p>单击按钮可打印当前页面。</p> <button onclick="window.print()">打印此页</button> </body> </html>