Code Explanation for onafterprint Attribute in HTML:
Onafterprint attribute is used to specify when the page starts printing and function OnAfterPrint() is called.
After the printer configuration settings, the function OnAfterPrint() will be called the alert message displaying ”This document is now being printed”.
Output for onafterprint Attribute in HTML:
When we press the CTRL+P to print the page, the print dialog box has been appeared.
After clicking the OK button in the print dialog box, the alert box has been displayed with the message ”The document is now being printed”.
Browser Support for onafterprint Attribute in HTML: