首页 新闻 会员 周边

其他浏览器正常打印,IE浏览器打印时弹出两次打印窗口

0
[已关闭问题] 关闭于 2014-09-22 16:58

父页面的打印按钮通过ajax打开新窗口

$.ajax({
url:'    ',
date:{ },
type:'Post',
dataTyoe:"json",
async:false,
success:function(date){
if(date !="")
result=window.showModalDialog("子页面路径", true, 'dialogWidth=900px,dialogHeight=600px,scrollbars=yes, status=no,resizable=yes');
},
......
if(result=="print"||!result){
continue;
}
} });



//子页面通过打印按钮打印

<script>
function Print() {
window.print();
window.close();
window.returnValue = "print";
}
</script>



<asp:Button ID="btnPrint" OnClientClick="Print();" runat="server" Text="打印"></asp:Button>

在谷歌、火狐。遨游浏览器上打印都没问题,在IE浏览器时,当点击子页面的打印按钮时,总是莫名其妙执行父页面中的

result=window.showModalDialog("..", true, 'dialogWidth=900px,dialogHeight=600px,scrollbars=yes, status=no,resizable=yes');这行代码(只执行这行,if语句不执行)。


不要说<base targer="_self">,它不合适,因为要考虑一次打印多个页面,用它的话最后window.print()执行,才会弹出打印窗口。不友好
LZ每天进步一点点的主页 LZ每天进步一点点 | 菜鸟二级 | 园豆:217
提问于:2014-09-04 09:02
< >
分享
所有回答(1)
0

OnClientClick="Print();window.close();"

乐享程序员 | 园豆:930 (小虾三级) | 2014-09-22 13:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册