2010-08-10 78 views
1

我有一個iframe,其內容來自模式窗口中服務器上另一個PHP頁面的內容。我想弄清楚如何使用iframe中的iframe關閉模式框。如何從該iframe中關閉iframe

我使用這個模式窗口插件:http://opensource.steffenhollstein.de/templates/modalbox/

按照這種方法關閉模態窗口中的文件:

jQuery.fn.modalBox.close(); 

如果我把它的iframe像這裏面:

<script type="text/javascript" src="jquery.js"></script> 
<script type="text/javascript" src="jquery.modalbox-1.0.9/js/jquery.modalbox-1.0.9-min.js"></script> 
<script type="text/javascript"> 
    //<!-- 
$(document).ready(function() { 

    $('.closeModalBox').click(function() { 
     jQuery.fn.modalBox.close(); 
    }); 

}); //--> 
</script> 

我有一個在iframe中的類.closeModalBox的輸入:

<input type="submit" name="zrusPridatElearningKurz" id="zrusPridatElearningKurz" value="Storno" class="input-submit closeModalBox" /> 

回答

1

嘗試window.parent.jQuery.fn.modalBox.close();我用這種方法用不同的彈出組件,但它可以幫助...