Css 打印机友好型页面不适用于IE8
我正在尝试拾取div的内容,并使用window.open在新窗口中打开它,以便用户可以打印此打印机友好的页面。我在网上的某个地方找到了代码,并做了一些修改。下面是代码片段Css 打印机友好型页面不适用于IE8,css,internet-explorer-8,window.open,Css,Internet Explorer 8,Window.open,我正在尝试拾取div的内容,并使用window.open在新窗口中打开它,以便用户可以打印此打印机友好的页面。我在网上的某个地方找到了代码,并做了一些修改。下面是代码片段 function printpage() { var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; disp_setting+="scrollbars=yes,width=650, height=600, le
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();
}
函数printpage(){
var disp_setting=“工具栏=是,位置=否,目录=是,菜单栏=是,”;
显示设置+=“滚动条=是,宽度=650,高度=600,左侧=100,顶部=25”;
var content\u vlue=document.getElementById(“memo\u data”).innerHTML;
var somestyle='#memottxt p{padding:0;margin:5px0;}';
var docprint=window.open(“,“sa”,显示设置);
docprint.document.open();
docprint.document.write(“部门间备忘录”);
docprint.document.write('div标记在下面的代码行中保持打开状态
docprint.document.write('</head><body><fieldset style="border:none;"><div class="memo-report-top"');
docprint.document.write('为什么不在弹出窗口中加载相同的页面,然后使用仅打印样式表来执行样式设置?因为这需要另一个css来隐藏页面的其他部分。我认为最好在打印页面中放置必要的内容。