Javascript Tryied window.open with Ajax,window.print不工作(IE9)
我正在尝试打开新窗口,并使用javascript和jquery-1.8.3发送表单数据 在伯恩哈德的帮助下,我成功地调用了一个新窗口,其中有一页可供打印 (非常感谢您。) 但是,Javascript Tryied window.open with Ajax,window.print不工作(IE9),javascript,jquery,Javascript,Jquery,我正在尝试打开新窗口,并使用javascript和jquery-1.8.3发送表单数据 在伯恩哈德的帮助下,我成功地调用了一个新窗口,其中有一页可供打印 (非常感谢您。) 但是,window.print()函数在IE9中不起作用!(FF,Chorme做得很好) 我刷新了页面,然后IE9调用window.print() 这是源代码 <a href="#" onclick="printPage()">Print this</a> <script type="text/
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>
函数printPage(){
$.post('/common/print.jsp',{view:$(“#ctn”).html()}).success(函数(响应){
var oWindow=window.open(“”,“打印窗口”,“宽度=700px,高度=800px”);
oWindow.document.write(响应);
oWindow.print();//我添加了这一行,但IE9不起作用。
});
}
有什么我错过的吗?试试这个:
$.post('/common/print.jsp', {view:$("#ctn").html()}).success(function(response){
var oWindow = window.open('', "printWindow", "width=700px,height=800px");
oWindow.document.write(response);
oWindow.document.close();
oWindow.focus();
oWindow.print(); // I added this line. But IE9 not working.
});
签出此:
使用HTTP头强制Internet Explorer 8及更高版本中的标准视图
还可以使用元标记强制标准模式。X-UA-Compatible元标记告诉Internet Explorer要使用或模拟的视图模式
通过设置此元标记,您可以告诉IE使用标准模式,即使DOCTYPE上方有注释或XML声明。
您确定哪个版本的Internet Explorer可以最好地查看页面
,然后设置元标记以定义该版本
IE 7:
<meta http-equiv="X-UA-Compatible" value="IE=7">
IE 8:
<meta http-equiv="X-UA-Compatible" value="IE=8">
IE 9:
<meta http-equiv="X-UA-Compatible" value="IE=9">
ie7:
IE 8:
IE 9:
如果客户访问的页面的查看模式高于其支持的模式
(例如,IE7浏览器查看页面时要求IE8查看模式),它
将忽略标记并以其应有的模式呈现页面
没有标签
更多信息请点击此处查看:试试这个:
$.post('/common/print.jsp', {view:$("#ctn").html()}).success(function(response){
var oWindow = window.open('', "printWindow", "width=700px,height=800px");
oWindow.document.write(response);
oWindow.document.close();
oWindow.focus();
oWindow.print(); // I added this line. But IE9 not working.
});
签出此:
使用HTTP头强制Internet Explorer 8及更高版本中的标准视图
还可以使用元标记强制标准模式。X-UA-Compatible元标记告诉Internet Explorer要使用或模拟的视图模式
通过设置此元标记,您可以告诉IE使用标准模式,即使DOCTYPE上方有注释或XML声明。
您确定哪个版本的Internet Explorer可以最好地查看页面
,然后设置元标记以定义该版本
IE 7:
<meta http-equiv="X-UA-Compatible" value="IE=7">
IE 8:
<meta http-equiv="X-UA-Compatible" value="IE=8">
IE 9:
<meta http-equiv="X-UA-Compatible" value="IE=9">
ie7:
IE 8:
IE 9:
如果客户访问的页面的查看模式高于其支持的模式
(例如,IE7浏览器查看页面时要求IE8查看模式),它
将忽略标记并以其应有的模式呈现页面
没有标签
更多信息请点击此处查看:是否存在强制打开compability view的问题?请检查此问题:我未能解决(我尝试了另一个例程),但您的回答对我帮助很大。谢谢Jai。是否有强制compability视图?签出此项:我未能解决(我尝试了另一个例程),但您的回答对我帮助很大。谢谢你,洁。