The onafterprint event is the opposite of the onbeforeprint event.
This example demonstrates how to assign an "onafterprint" event to a body element.
<!DOCTYPE html> <html> <body onafterprint="myFunction()"> <p id="demo"></p> <h1>Try to print this document</h1> <script> function myFunction() {/*from w w w .java 2s.c o m*/ document.getElementById("demo").innerHTML = "This document is now being printed"; } </script> </body> </html>