Javascript IE9&x2B;在iframe的contentWindow上调用focus()时,给出无效的调用对象错误
我有这个javascript功能,我用它来打印包含在iframe中的pdf文档:Javascript IE9&x2B;在iframe的contentWindow上调用focus()时,给出无效的调用对象错误,javascript,asp.net,pdf,iframe,printing,Javascript,Asp.net,Pdf,Iframe,Printing,我有这个javascript功能,我用它来打印包含在iframe中的pdf文档: function printFrame1() { var frm = window.frames["IfPol_app"]; // or document.getElementById("IfPol_app").contentWindow frm.focus();// focus on contentWindow is needed on some ie versions f
function printFrame1() {
var frm = window.frames["IfPol_app"]; // or document.getElementById("IfPol_app").contentWindow
frm.focus();// focus on contentWindow is needed on some ie versions
frm.print();
}
iframe元素如下所示:
<iframe runat="server" id="IfPol_app" frameborder="0" width="100%" height="630px" />
浏览器(chrome、firefox、IE8-)打印窗口会显示pdf,IE9+在focus()方法调用中给出了以下错误:
0x8000ffff-JavaScript运行时错误:调用对象无效
我搜索了所有与contentWindow、contentDocument、iframe、pdf打印相关的主题,但我找不到解决此问题的方法,请任何人帮忙
谢谢你你检查过了吗,
frm
实际上是什么?frm是contentWindow,只是我的同事把它重新命名为那样的:你检查过frm
真的是指“contentWindow”吗?如果你把console.log(frm)
放在var
行之后,你会看到什么?这里的这个家伙和我有同样的问题,这里是演示是的,你可能是对的,我估计还没有人找到解决这个问题的方法或解决办法,我搜索了一整天,但没有运气