【问题标题】:Fetch particular field from moodialog and pass value to parent screen从 moodialog 获取特定字段并将值传递给父屏幕
【发布时间】:2012-08-31 08:57:16
【问题描述】:

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

【问题讨论】:

    标签: php javascript iframe mootools


    【解决方案1】:

    我找到了解决办法:

    从 popup_window.php 文件中通过框架获取元素的 id。我们需要使用以下代码:

    onClose: function()
    {   
        var myIFrame = document.getElementById("MooFrame");
        var content = myIFrame.contentWindow.document.getElementById('abcd').value;
    
        alert('content: ' + content);   
    
        location.reload();                                                                          
    }
    

    【讨论】:

      猜你喜欢
      • 2014-01-03
      • 2015-01-27
      • 2011-08-01
      • 2019-04-29
      • 2018-03-22
      • 2014-03-18
      • 2020-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多