php - 从 moodialog 中获取特定字段并将值传递给父屏幕

标签 php javascript iframe mootools

我使用了 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/

相关文章:

php - 如何检查mysql表中多行中的值与每行中的唯一数据关联

php - 代码点火器 AOP

javascript - 使用 $q.all 进行同步 http 调用不工作 angularjs

azure - 使用 google gview 在 iframe 中嵌入 Azure blob pdf 文件

javascript - 使用 PHP 的 Chrome native 消息传递

php - 使用php或js控制加载的flash文件

javascript - IsAnagram,为什么是- 97? - JavaScript

javascript - 如何在我的简单 Express 应用中使用 Node.js 集群?

javascript - 从 iframe 外部调用 iframe 内的函数

reactjs - 如何使用React使YouTube嵌入100%的宽度