Hello,
I have a complex form and a 'Print' button which should print only the contents of a specific DIV.
I am using the following function (i found on another forum):
function PrintContent() {
var DocumentContainer = document.getElementById('divName');
var WindowObject = window.open('', 'PrintWindow', 'width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes');
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}
While using this, the CSS styling of the DIV are missing.
How can I print the DIV's contents and keep the CSS styling.
Before using that function, I tried "execCommand("Print")" but the results weren't good at all. it printed only a small part of the content.
How can I achieve that?
Thanks,
Dana