populate data in parent window from a popup window , php
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
精彩评论