Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1489 How do I print a page generated using document.write()?

irt.org | Knowledge Base | JavaScript | Print | Q1489 [ previous next ]

Q1489 How do I print a page generated using document.write()?

Make sure that the document.write statements are enclosed in document.open() and document.close():

var win1 = window.open('', 'Example1');
win1.document.open();
win1.document.write('<head><title>Print Me</title></head>');
win1.document.write('This page will print properly, ')
win1.document.write('even though it was dynamically generated.')
win1.document.close();

var win2 = window.open('', "Example2);
win2.document.write('<head><title>Print Me</title></head>');
win2.document.write('This page won\'t print.')

Feedback on 'Q1489 How do I print a page generated using document.write()?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.