У меня есть iframe внутри модального диалогового окна. Могу ли я закрыть модальное поле, нажав на кнопку внутри поля, называемую в Iframe ..? - PullRequest
2 голосов
/ 02 апреля 2012
I want to close both the i frame as well as the modal dialog box on a button click present inside the file which is called in the iframe.. the file included in the i frame is an external file having tabs.. So how to close the dialog box and iframe on a button click which is defined in the file..

Я искал сеть несколько дней, но не решил проблему ....

//My Code for the iframe for and modal dialog box is as follows..


I want to close both the i frame as well as the modal dialog box on a button click present inside the file which is called in the iframe.. the file included in the i frame is an external file having tabs.. So how to close the dialog box and iframe on a button click which is defined in the file..

// here is the code for i frame

<div id="dialog_with_tabs" title="Vehicle Selection">// div of modal dialog
<div id="tabs_in_dialog">
<ul>
</ul>
<iframe id="myframe"  src="add.php" width="100%" height="400" frameborder="0" scrolling="auto" seamless="seamless">  /// here i have included a file which has tabs..
</iframe>  /*****************End of Iframe*********************/

</div>
</div>

/ ******************** Конец Div модального диалогового окна ***********************/ Я хочу закрыть как i-кадр, так и модальное диалоговое окнопри нажатии кнопки, присутствующей внутри файла, который вызывается в iframe .. файл, включенный во фрейм i, является внешним файлом, имеющим вкладки. Итак, как закрыть диалоговое окно и iframe при нажатии кнопки, которая определена в файле..

//code for modal dialog box popup is as follows..

<script type="text/javascript" >           //script for modal dialog
$("#dialog_with_tabs").dialog({
bgiframe: true,
autoOpen: false,
height: 400,
width: 700,
modal: true,
buttons: {

}
});

$("#dialog_with_tabs").bind('dialogopen', function() {
/* init tabs, when dialog is opened */

$("#tabs_in_dialog").tabs();
});
$("#dialog_with_tabs").bind('dialogclose', function() {
/* your function */
window.location.reload(true);
/* destroy tabs to avoid problems on re-open */
$("#tabs_in_dialog").tabs('destroy');
/* destroy dialog to avoid problems on re-open */
$("#dialog_with_tabs").tabs('destroy');
});
/* your function to open the dialog */
$('#tabtest').click(function() {
$('#dialog_with_tabs').dialog('open');
}) 
//$("#dialog_with_tabs").dialog('open'); //  opens the modal dialog
<!-- jquery part -->
</script>

/ ********************* Конец сценария ********************* /
Я хочу закрыть как фрейм i, так и модальное диалоговое окно при нажатии кнопки, присутствующей внутри файла, который вызывается в iframe. Файл, включенный в фрейм i,внешний файл, имеющий вкладки .. Так как закрыть диалоговое окно и iframe по нажатию кнопки, которая определена в файле ..

// so how can close the dialog and iframe on a button click

любая помощь будет оценена ......

1 Ответ

0 голосов
/ 21 октября 2015

Не уверен, как именно это реализовать, но я думаю, что этот маршрут будет работать!

http://davidwalsh.name/window-postmessage

Или попробуйте эту ветку?

Передать переменные jquery между iframe и родителем

...