Is anyone able to make this code crossbrowser? Can it actually be done?
It brings up the print dialog box and will print out the contents of a textarea box, but only in IE.
[CODE]/*
for notepad printouts
*/
function printInput(f){
var ifr = window.frames[‘printFrame’];
if (ifr){ //print the content of the invisible iframe
ifr.document.getElementById(‘content’).innerHTML=f.WRKNOTEPAD.value.replace(/n/g,'<br />’);
ifr.focus();
ifr.print();
}
else { //print by opening a new window and then closing it
var html='<html><head><style type=”text/css”>div{font:normal 14px Verdana}</style></head><body onload=”window.print();window.close()”><div>’+f.WRKNOTEPAD.value.replace(/n/g,'<br />’);+'</div></body></html>’
var win = window.open(”,’_blank’,’menubar,scrollbars,resizable’);
win.document.open();
win.document.write(html);
win.document.close();
}
}
function writeContent(objIframe){
var html='<html><head><style type=”text/css”>div{font:normal 14px Verdana}</style></head><body><div id=”content”></div></body></html>’
objIframe.document.write(html);
objIframe.document.close();
}