asp.net.ph

onbeforeprint Event

DHTML Events


Fires on the object just before its associated document prints.

Syntax


Inline HTML <element onbeforeprint = "handler" ... > All platforms
Event property object.onbeforeprint = handler ECMA-262 Language Specification
Named script <script FOR=object EVENT = onbeforeprint> Internet Explorer® only

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 choose Print from the File menu.
  • From Windows Explorer, right-click on an .htm file and choose Print.
Default action Prints the document associated with the object for which the event is specified.

This event gives the Web author an opportunity to modify the document just before it prints; in most cases, to make all the information on the page visible just before printing.

The event is usually used in conjunction with the onafterprint event, which provides a means for the Web author to undo the changes made to the document in the onbeforeprint event.

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 onbeforeprint event can be used to make all currently hidden sections of the page visible just before the page prints. The onafterprint event is then processed, after the page prints, to revert the document back to its original state.

Sample Code


Applies To

window, BODY, FRAMESET

See Also

onafterprint, print




Contents
HTML Elements
HTML Element Attributes
CSS Attributes
DOM Objects
DOM Object Properties
DOM Events Reference
DOM Methods Reference
DOM Collections Reference
 

Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph