需要从jquery iframe对话框中调用parent函数

时间:2015-05-22 16:27:11

标签: jquery

1)Frame.jsp

<div id="existingEndorsement" style="font-size:12px; height:200px !important; display: none;" >
    <iframe id="existingEndorsementFrame" width="410" height="200"></iframe>
</div>

2)ExistingEndorsement.jsp

function openExistingEndorsementPopup() {
      parent.$("#existingEndorsementFrame").attr('src', ExistingEndorsementAlert.jsp);
        parent.$("#existingEndorsement").dialog({ title: "Existing Incomplete Endorsement " });
        parent.$("#existingEndorsement").dialog( "open" );
    }
  1. ExistingEndorsementAlert.jsp - 我有按钮。点击我想调用EndorsementBasicInfo.jsp
  2. 中存在的函数

1 个答案:

答案 0 :(得分:0)

您可以在iframe中使用顶部作为父元素;

function openExistingEndorsementPopup() {
        top.$("#existingEndorsementFrame").attr('src', ExistingEndorsementAlert.jsp);
        top.$("#existingEndorsement").dialog({ title: "Existing Incomplete Endorsement " });
        top.$("#existingEndorsement").dialog( "open" );
}