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嗎? –