asp.net.ph

Skip Navigation Links

onafterprint Event


Fires on the object immediately after its associated document prints.

Syntax

Inline <element onafterprint = "handler" ... >
Script object.onafterprint = handler

Remarks

Bubbles No
Cancels No
To invoke
  • Choose Print from the File menu in Internet Explorer.
  • Press CTRL + P.
  • Right-click anywhere on a page, and choose Print.
  • Right-click on a link on a page, and choose Print.
  • From Windows Explorer, select an .htm file, and then choose Print from the File menu.
  • From Windows Explorer, right-click on an .htm file, and then choose Print.
Default Action None

This event is usually used in conjunction with the onbeforeprint event. Whereas the onbeforeprint event gives the Web author an opportunity to make changes to the document just before it prints, the onafterprint event provides a means to undo those changes, reverting the document back to its pre-print state.

Event Object Properties

Although event handlers in the document object model do not receive parameters directly, the handler can query the event object for data.

Event Object Properties


Example

The following example demonstrates how the onafterprint event can be used to bring the document back to its pre-print state.

In this case, since the onbeforeprint event handler made all currently hidden sections of the page visible for printing purposes, the onafterprint event is used to set those sections back to hidden.

Sample Code


Applies To

window, BODY, FRAMESET

See Also

onbeforeprint, print


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note