Javascript 在IE9上使用iFrame时出现多个错误
我的页面中的Javascript 在IE9上使用iFrame时出现多个错误,javascript,jquery,asp.net,internet-explorer-9,Javascript,Jquery,Asp.net,Internet Explorer 9,我的页面中的div中有一个iframe,如下所示: <div id="ModalContato" style="display: none; text-align: center;"> <iframe id="IfrModalContato" frameborder="0" scrolling="yes" src="" style="width: 100%; height: 100%;"></iframe> </div>
div
中有一个iframe
,如下所示:
<div id="ModalContato" style="display: none; text-align: center;">
<iframe id="IfrModalContato" frameborder="0" scrolling="yes" src="" style="width: 100%;
height: 100%;"></iframe>
</div>
function onShow() {
$("#IfrModalContato").attr("src", "ContatoModal.aspx?Modal=1&IdContatoPai=" + $("#ctl00_Corpo_HidIdContato").val());
$("#ModalContato").dialog({ modal: true, title: 'Cadastro de contatos', width: 970, height: 570 });
$("#ModalContato").dialog('open');
}
当我点击打开模式的按钮时,我会看到很多JS错误,比如:
'Array' is not defined
'Object' is not defined
'Function' is not defined
有一个家伙似乎和我一样有问题(我的问题也只发生在IE9上),但作为JS和jQuery上的noob,我不知道如何使我的代码适应他所说的
我试过这样的方法:
<div id="ModalContato" style="display: none; text-align: center;">
<iframe id="IfrModalContato" frameborder="0" scrolling="yes" src="" style="width: 100%;
height: 100%;"></iframe>
</div>
function onShow() {
$("#IfrModalContato").attr("src", "ContatoModal.aspx?Modal=1&IdContatoPai=" + $("#ctl00_Corpo_HidIdContato").val());
$("#ModalContato").dialog({ modal: true, title: 'Cadastro de contatos', width: 970, height: 570 });
$("#ModalContato").dialog('open');
}
但这对我来说是行不通的。
有人吗
谢谢。这只是猜测,但请确保框架和页面中没有包含相同的jquery脚本文件。IE不喜欢这样,这就是为什么我不使用iFrame,或者只在父页面中使用一组脚本,您可以在iFrame窗口中使用这些脚本。您可以在JSFIDLE上发布吗?因此,我们将更容易编辑和测试您的代码。谢天谢地,我正在使用asp.net,我只知道JSFIDLE执行js代码,但老实说,我不知道如何将代码以运行方式粘贴到那里。如果我把我所有页面的代码都粘贴到这里,会对您有所帮助吗?我已经为您制作了一个JSFIDLE。但我不知道为什么它说函数没有定义。我很困惑:/