运行结果尺寸: 300 x 150
x
 
<!DOCTYPE html>
<html>
<body>
<p>此示例使用 addEventListener() 方法将“afterprint”事件附加到窗口对象。</p>
<h1>尝试打印这份文件</h1>
<p><b>提示:</b>键盘快捷方式,例如 Ctrl+P 设置要打印的页面。</p>
<p><b>注意:</b> Safari 和 Opera 不支持 afterprint 事件。</p>
<p><b>注意:</b> 在 IE 中,afterprint 事件发生在打印对话框之前,而不是之后。</p>
<script>
window.addEventListener("afterprint", myFunction);
function myFunction() {
  alert("该文档正在打印中");
}
</script>
</body>
</html>
×

报个问题: