[whatwg] [html5] onbeforeprint/onafterprint (was window.print() undefined)

Dean Edwards dean at edwards.name
Wed Jul 20 09:13:04 PDT 2005


The big problem for me on this whole onbeforeprint/onafterprint argument 
is that I only have partial control of the DOM using JavaScript.

What do I mean by this?

I can create content using the window's load event:

onload = function() {
  // create content for screen
}

This content, which is not suitable for print, needs to be removed when 
the document is printed. I can even invoke the print method myself:

window.print();

I'm told I must use another language to remove the content. CSS you say. 
Doesn't that seem wrong? Why can't I do it with script? I created the 
content with script. Why can't I remove it the same way?

-dean




More information about the whatwg mailing list