popup, sending data back to parent
when I click a button, popup window opens. There I get user detail from facebook. that data I have to pass to parent window form. this 开发者_运维技巧i can do using
opener.document.signup2.'.$key.'.value="'.$value.'";
but this is working for textbox. how to do for radio button. example. If gender is female in popup. corresponding option should be selected in parent form.
radio buttons are stored in an array, so you'd have to figure out what index in that array represents the option to check, then set that element's 'checked' attribute:
radioObject = opener.document.signup2.whateveryourradiobuttonnameis;
for (i = 0; i < radioObject.length; i++) {
if (radioObject[i].value == 'value you want to have selected') {
radioObject[i].checked = true; // check new radio button
} else {
radioObject[i].checked = false; // uncheck the others.
}
}
精彩评论