The onafterprint
attribute event is triggered
when a page has started printing, or if the print dialogbox has been closed.
The onafterprint
attribute is new in HTML5.
<element onafterprint="script or javascript function name">
<body>
onafterprint |
No | Yes | Yes | No | No |
<!DOCTYPE html>
<html>
<body onafterprint="myFunction()">
<!-- w ww.ja v a 2 s.c om-->
<h1>print this document</h1>
<script>
function myFunction() {
alert("printed");
}
</script>
</body>
</html>