【问题标题】:simplemodal close iframe form after submit?提交后simplemodal关闭iframe表单?
【发布时间】:2011-05-31 09:40:21
【问题描述】:

Simplemodal 完美运行,但我不知道如何在提交表单后自动关闭 iframe。 我试图使用 js 在模态选项之外获取事件,但是 如果我在提交事件上关闭模态窗口,则不会提交表单...

我还在输入按钮中添加了simplemodal-close类,但它在表单中不起作用??

有什么建议吗?? 这是我的代码

//模态窗口

modal.click(function(e){
  e.preventDefault();
  $.modal('<iframe src="' + this.href + '" height="480" width="525" style="border:0" >',{
        containerCss:{
        backgroundColor:"#fff"
    },
    overlayClose:true,
    onShow: function (dialog) {
    $("input",dialog.data).click(function (e) {
        e.preventDefault();
        alert('Here'); //Doesnt execute
        $.modal.close();
    parent.$.modal.close();
    alert('Here');
    });
  }
});

【问题讨论】:

    标签: iframe simplemodal


    【解决方案1】:

    好吧,我刚做了。。我没有使用 iframe,因为在 parent.$.modal.close() 之后。。那个 iframe 中包含的 js 不再执行了。。

    所以我就是这样做的..

     //Modal Window
    modal.click(function(e){
        e.preventDefault();
        $.get(this.href,function(data){
    
            var resp = $('<div></div>').append(data); // wrap response
            $(resp).modal({
                overlayClose:true,
                minHeight:450,
                minWidth: 500,
                containerCss:{
                    backgroundColor:"#fff",
                    borderColor:"#fff"
                    },
                onShow: function(dialog){
                    autocomplete();
                }
            });
        });
    
     });
    

    如果我使用 div 而不是 iframe,当我提交时,模态框会关闭,否则它会保持打开状态....

    这很容易,但我很困惑..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多