alanr
12-07-2009, 02:05 PM
The following JavaScript seems to work correctly in all browsers I've tried so far apart from Opera (I’m using version 10.10). The problem seems to be that the .Print(); call does not bring up the print dialog as on other browsers. Any help in getting this working for all browsers would be appreciated.
function Print(id) {
var DocumentContainer = document.getElementById(id);
var WindowObject = window.open("", "PrintWindow", width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
WindowObject.document.write('<body style="font-family:verdana; font-size:12px;">');
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}
function Print(id) {
var DocumentContainer = document.getElementById(id);
var WindowObject = window.open("", "PrintWindow", width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
WindowObject.document.write('<body style="font-family:verdana; font-size:12px;">');
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}