HTML事件属性onbeforeprint

2018-01-05 13:58 更新

HTML事件属性onbeforeprint


onbeforeprint 属性事件是当页面即将打印时或在打印对话框出现前触发。

HTML5中的新功能

onbeforeprint 属性是HTML5中的新特性。

句法

<element onbeforeprint="script or javascript function name">

支持的标签

<body>

浏览器兼容性

onbeforeprint Yes Yes Yes Yes Yes


例子

<!DOCTYPE html>
<html>
<body onbeforeprint="myFunction()">

<h1>Try to print this document</h1>

<script>
function myFunction() {
    alert("print");
}
</script>

</body>
</html>

Click to view the demo



以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号