|
It is far easier to set up classes for showing and hiding the parts of the page and simply attach the appropriate classes to the page to control which piece is to print rather than recreating the entire page.
language="javascript" was killed off about 10 years ago - at the moment toy should be using type="text/javascript" so as to support IE8 and modern browsers and once IE8 is dead the correct value of type="application/javascript" can be used.
Your code copies the body of the page and then overwrites just the body with an entire generated page including a head tag that means the page you are trying to print has two <head> sections one after the other.
Plus of course the antiquated document.all calls for IE4 instead of the document.getElementById calls that all modern browsers (and even IE5) use instead (but Old Pedant already told you about that bit).
Last edited by felgall; 11-29-2012 at 01:12 AM..
|