-2

このようなJavaScript関数があります。これらの値をポップアップ ウィンドウの JavaScript から親ウィンドウに渡す方法を教えてください。私は私が使用しなければならないことを知っています

window.opener.document.getelementbyD("ID Of TextBox");

私の子aspxページのメソッドですが、textbox別のユーザーコントロール内にあります。どうすればいいのですか?

function(PersonName, EmailID){
    //assign these values to text boxes of  a parent window 
    //the text boxes of parent window are inside of  control
}

よろしく
-ヴィシュ

4

1 に答える 1

0

2 つの単純な JS 関数を作成できます。ポップアップによって呼び出される「親」ウィンドウの 1 つ (setValues)。そして、ポップアップ (setValuesToParent) で値を収集し、親ウィンドウで関数を呼び出します。この例はプレーンな JavaScript で書かれており、asp.net などを使用していないことを忘れないでください。

// in your pop up 
function setValuesToParent() {
    var PersonName= document.getElementById('PersonNameInPopUp').value;
    var EmailID = document.getElementById('EmailIDInPopUp').value;
    window.opener.setValues(PersonName, EmailID); // this is the important line
}



// in your parent window
function setValues(PersonName, EmailID) {
    document.getElementById('PersonName').value = PersonName;
    document.getElementById('EmailID').value = EmailID;
}
于 2013-03-05T07:56:05.690 に答える