【问题标题】:Multiple errors using iFrame on IE9在 IE9 上使用 iFrame 出现多个错误
【发布时间】:2012-11-23 20:01:31
【问题描述】:

我的页面中的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 AbreModalContato() {
    $("#IfrModalContato")[0].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

this question 上,有一个人似乎和我一样有问题(我的问题也只发生在 IE9 上),但作为 JS 和 jQuery 的菜鸟,我不知道如何使我的代码适应他所说的.

我尝试过这样的事情:

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');         
}

但这对我不起作用。 有人吗?

谢谢。

【问题讨论】:

  • 你能在 jsfiddle 上发帖吗?因此我们将更容易编辑和测试您的代码。谢谢
  • 嗯,我正在使用 asp.net,我只知道 jsfiddle 执行 js 代码,但老实说,我不知道如何将我的代码粘贴到那里以使其运行。如果我在这里粘贴我所有页面的代码会对您有所帮助吗?
  • 我为你做了一个 jsfiddle。 Here 但是不知道为什么说函数没有定义。我很困惑:/

标签: javascript jquery asp.net internet-explorer-9


【解决方案1】:

这只是一个猜测,但请确保您没有在框架和页面中包含相同的 jquery 脚本文件。 IE 不喜欢这样,这就是为什么我不使用 iFrame 或只在父页面中使用一组脚本,您可以在 iFrame 窗口上使用这些脚本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 2011-12-12
    • 1970-01-01
    • 1970-01-01
    • 2014-05-04
    • 1970-01-01
    相关资源
    最近更新 更多