Using the following javascript code you can return a variant value from modaldialog window to parent window.
When you call showModalDialog you do this:
Code:
var oReturnValue = window.showModalDialog("subDoc.html",argsVariable,
"dialogWidth:300px; dialogHeight:200px; center:yes");
Within showModalDialog, assuming your textboxes have IDs of "txtForename" and "txtSurname":
Code:
function terminate()
{
var o = new Object();
o.forename = document.getElementById("txtForename").value;
o.surname = document.getElementById("txtSurname").value;
window.returnValue = o;
}
Then continuing in your main window:
Code:
alert(oReturnValue.forename + "\n" + oReturnValue.surname);
No comments:
Post a Comment