function printpage() {
var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
var content_vlue = document.getElementById("memo_data").innerHTML;
var somestyle = '<style type="text/css"> #memotxt p {padding:0 0 0 0;margin:5px 0 0 0;}</style>';
var docprint=window.open("","sa",disp_setting);
docprint.document.open();
docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Inter Office Memo</title>');
docprint.document.write('<link type="text/css" rel="stylesheet" href="../../Content/style.css"');
//docprint.document.write(somestyle);
docprint.document.write('</head><body><fieldset style="border:none;"><div class="memo-report-top"');
docprint.document.write(content_vlue);
docprint.document.write('</div></fieldset></body></html>');
docprint.document.close();
docprint.focus();
}
当我在firefox中打开这个页面时,它的工作方式与预期完全相同,但当我在IE8中打开页面并按下print按钮时,会触发printpage()函数。一扇新窗户弹出,看上去很难看。我也在打印机友好页面中调用了一个css文件,但当我在IE8开发工具中检查它时,它只显示了应用于body和fieldset的css属性。其余的物业都不在。
非常感谢您的建议和帮助