我使用了 MooDialog.iframe 和 onClose 我需要一些值。但无法从该 iFrame 中获取值并想在我在弹出窗口中打开此框架的页面中使用。
我用于弹出窗口的函数/代码如下:
function popup_window() {
var hostname = location.protocol + "//" + location.hostname + (location.port && ":" + location.port) + "/";
var opcion = "crear";
co2=new MooDialog.IFrame(hostname+'infinity/contabilidad/cuenta%20crear/popup_window.php?action=2',
{
title: 'Editar Centro','class' : 'content_edit1 MooDialog',
onClose: function()
{
/////////alert(document.getElementById('numero_cuenta').value);
//numero_cuenta is something i want
location.reload();
}
}
);
}
numero_cuenta 是弹出iframe的input.text的id。
最佳答案
我找到了解决方案:
从 popup_window.php 文件中通过框架通过 id 获取元素。我们需要使用以下代码:
onClose: function()
{
var myIFrame = document.getElementById("MooFrame");
var content = myIFrame.contentWindow.document.getElementById('abcd').value;
alert('content: ' + content);
location.reload();
}
关于php - 从 moodialog 中获取特定字段并将值传递给父屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12212032/