View Single Post
Old 11-29-2012, 01:09 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,468
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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).
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 11-29-2012 at 01:12 AM..
felgall is offline   Reply With Quote