1
我有一个动态的div类。 div内的元素通过后端ajax Web服务请求动态填充。 : -打印div元素不适用于IE?
<div class="hidden">
<asp:Button ID="Button1" runat="server"
Height="23px" style="margin-top: 0px" Width="69px" text="Print" OnClientClick="PrintElem('#hidden'); return false;"/>
</div>
这个div类里面有一个动态填充的元素列表。 我想在这个div类中使用打印按钮来打印所有元素。
function PrintElem(elem) {
Popup($(elem).html());
}
function Popup(data) {
var mywindow = window.open('', '.hidden', 'height=400,width=600');
mywindow.document.write('<html><head><title>Pharmacy List</title>');
/*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.print();
mywindow.close();
return true;
}
* 这个伟大工程,除了IE所有Web浏览器。 *
先给窗口的名称看起来像一个有效的JavaScript标识符(不像“#hidden”)。 – Pointy
你怎么用'#hidden'获得class =“hidden”'? – reyaner
IE中有什么问题?你可以用你的代码创建一个jsfiddle吗? –