【发布时间】:2013-01-09 05:57:45
【问题描述】:
我正在尝试使用 javascript 和 jquery-1.8.3 打开新窗口并发送表单数据。
在 Bernhard 的帮助下,我成功调用了一个带有打印页面的新窗口。
(非常感谢伯恩哈德。window.open and sending form data not working)
但是,window.print() 函数在 IE9 中不起作用! (FF,Chorme 做得很好)
我刷新了页面,然后IE9调用window.print()
这里是源代码。
<a href="#" onclick="printPage()">Print this</a>
<script type="text/javascript" src="/common/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
function printPage(){
$.post('/common/print.jsp', {view:$("#ctn").html()}).success(function(response){
var oWindow = window.open('', "printWindow", "width=700px,height=800px");
oWindow.document.write(response);
oWindow.print(); // I added this line. But IE9 not working.
});
}
</script>
我错过了什么吗?
【问题讨论】:
标签: javascript jquery