开发者

populate data in parent window from a popup window , php

开发者 https://www.devze.com 2023-02-11 06:37 出处:网络
i want populate data in parent window from a popup window. can any one help me pls. POPUP window: foreach ( $user_info as $key => $value) {

i want populate data in parent window from a popup window. can any one help me pls.

POPUP window:

        foreach ( $user_info as $key => $value) {
        echo   '<label> : <input type="text" name="'.$key.'" id="'.$key.'" size="30" value="'.$value.'" >'.$key .'</label><br>';
                 }
         echo '
                  <s开发者_C百科cript type="text/javascript">

                 function get_data (){
                 opener.document.forms[1].inputname.value = "new value"; 
                 window.close();
}

             </script>

          ';
          echo '<input type="button" name="submit" id="submit" size="30" value="submit" onclick="get_data();">';

above one is not working.


have you tried using window.opener instead of just opener? Also shouldn't that be forms[0] unless you are after the second form on the parent document? Personally I would avoid referring to forms by their index number and use either:

window.opener.document.forms.form_id.inputname.value

or window.opener.document.getElementById('inputname').value

0

精彩评论

暂无评论...
验证码 换一张
取 消