Javascript Window.Print()Div是否带有溢出-x?
我想打印一个div有Javascript Window.Print()Div是否带有溢出-x?,javascript,internet-explorer,Javascript,Internet Explorer,我想打印一个div有overflow-x:auto属性(它包装多个页面宽度) 在Chrome中,页面被缩放,显示正确。然而,在IE(8-10)中,它切断了屏幕上可见部分的div 以下是我的职责: function print() { var printContent = document.getElementById("<%=printable.ClientID%>"); var windowUrl = 'about:blank';
overflow-x:auto代码>属性(它包装多个页面宽度)
在Chrome中,页面被缩放,显示正确。然而,在IE(8-10)中,它切断了屏幕上可见部分的div
以下是我的职责:
function print() {
var printContent = document.getElementById("<%=printable.ClientID%>");
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=5000,top=5000,width=0,height=0');
printWindow.document.write("<html> ");
printWindow.document.write("<head> ");
printWindow.document.write("<link type=text/css rel=stylesheet href='/eBusinessStylesNew.css' /> ");
printWindow.document.write("</head> ");
printWindow.document.write("<body topmargin=0 leftmargin=0 bgcolor='#ffffff'> ");
printWindow.document.write(printContent.innerHTML);
printWindow.document.write("</body> ");
printWindow.document.write("</html> ");
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
return false;
}
函数打印(){
var printContent=document.getElementById(“”);
var windowUrl='about:blank';
var uniqueName=新日期();
var windowName='Print'+uniqueName.getTime();
var printWindow=window.open(windowUrl,windowName,'left=5000,top=5000,width=0,height=0');
printWindow.document.write(“”);
printWindow.document.write(“”);
printWindow.document.write(“”);
printWindow.document.write(“”);
printWindow.document.write(“”);
printWindow.document.write(printContent.innerHTML);
printWindow.document.write(“”);
printWindow.document.write(“”);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
返回false;
}
有什么我可以添加到函数中以正确打印我的div吗?试试这个(在
之后):
printWindow.document.write('u div{overflow-x:visible;}的一个u选择器);
也许我离题了,但您不能在打印之前处理div的隐藏副本并移除溢出吗?
printWindow.document.write('<style media="print">a_selector_for_the_div{overflow-x:visible;}</style>');