How to print only parts of a page?
css, filter, printing
Solution
IE supports `onbeforeprint` and `onafterprint`, but what you really want is a print stylesheet.
<link rel="stylesheet" type="text/css" media="print" href="print.css">
See also: this answer
Problem
I am trying to hide some divs before the user prints this giant form, then display the divs again afterward. Thus I want to ignore the rest of the page, and only print the form itself. Sure I could open a separate page when the user clicks the print button. The only thing is that the form is really long and it would be quite tedious to do that. Edit: My previous question did not actually reflect what I was looking for. So I changed it to the current one. Also thanks to all that suggested window.onbeforeprint and window.onafterprint. That was relevant to my edited question.