2012-08-31 40 views
1

我使用MooDialog.iframe和onClose我需要一些值。但无法从该iFrame中获取值并想在页面中使用,我在弹出窗口中打开了此框架。从moodialog获取特定字段并将值传递给父屏幕

的功能/代码我用于弹出低于:

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。

回答

2

我找到了解决办法:

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

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

    alert('content: ' + content); 

    location.reload();                   
} 
相关问题