Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access parent document from IE modal dialog? 1

Status
Not open for further replies.

xpblueScreenOfDeath

Programmer
Sep 1, 2004
87
In IE, is it possible to access a form element of a parent winodw from a modal dialog?

I tried:

<code>
document.parent.document.getElementById(...)
document.opener.document.getElementById(..l)
</code>
 
i believe you'd have to pass in a reference to it, e.g.
Code:
var obj = new Object();
obj.parent = window;
vReturnValue = window.showModalDialog(sURL , obj);

and it would be accessible via the dialogArguments object of the modal window:

Code:
var parent = window.dialogArguments.parent;

-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
The document object has neither an opener property nor a parent property. Those properties belong to the window object. Try:

window.opener.document.getElementById(...)
window.parent.document.getElementById)...)

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
showModalDialog doesn't have an opener or parent. Jeff is right, you can pass any object you want in the second argument, like one that has a property set to a reference of the window object (like in Jeff's example) or you could pass the window object itself if you wanted.
Code:
window.showModalDialog(sURL , [b]window[/b]);

Code:
var opener = window.dialogArguments;


Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top