This example uses the HTML DOM to assign an "onbeforeprint" event to a body element.
Tip: The keyboard shortcut Ctrl+P prints a page.