2011-05-31 71 views
0

Simplemodal完美工作,但我不知道如何在提交表單後自動關閉Iframe。 我試圖用JS來獲取模式選項之外的事件,但 如果關閉提交事件,表單不會提交模態窗口...提交後關閉iframe表單?

我還添加了類simplemodal關閉到輸入按鈕,但它的工作形式?

有什麼建議? 這裏是我的代碼

//模態窗口

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

回答

0

好吧,我只是做了它..我沒有因爲後父。$使用iframe。modal.close()..包含在JS的IFRAME didnt執行了..

所以我就做了這樣..

//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 ,,當我提出,模態,否則將關閉其打開.. ..

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