Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<h1>HTML DOM Events</h1>
<h2>The afterprint Event</h2>
<body onafterprint="myFunction()">
<h3>Print this document!</h3>
<p><b>Tip</b>: The keyboard shortcut Ctrl+P prints a page.</p>
<script>
function myFunction() {
  alert("This document is now being printed");
}
</script>
</body>
</html>