I have a an iframe with content from another PHP page on my server inside a modal window. I would like to figure out a way how to close the modal box with the iframe from inside the iframe.
I am using this modal window plugin: http://opensource.steffenhollstein.de/templates/modalbox/
According to the documentation this method closes the modal window:
jQuery.fn.modalBox.close();
If I put it inside the iframe like this:
<script type="text/javascript" src="jquery.js"></script>
&开发者_StackOverflowlt;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>
I have an input with the class .closeModalBox in the iframe:
<input type="submit" name="zrusPridatElearningKurz" id="zrusPridatElearningKurz" value="Storno" class="input-submit closeModalBox" />
Try window.parent.jQuery.fn.modalBox.close();
I have used this approach with a different popup component, but it could help...
精彩评论