Computer Hope

Internet & Networking => Web design => Topic started by: dmjpro on March 07, 2007, 02:36:38 AM

Title: accessing parent window of the modal dialog box ??
Post by: dmjpro on March 07, 2007, 02:36:38 AM
i want to access the parent window (opener window) from a modal dialog box ....

can't i do that using window.opener from modal dialog box .....

i did it but i failed .... plz help me out ......

one guy from another forum answered me that it can be only done using .....
window.dialogArguments..... but my window.showModalDialog code already written... in many palces .....

how can i do that ......

thanx
Title: Re: accessing parent window of the modal dialog bo
Post by: Rob Pomeroy on March 12, 2007, 06:26:56 AM
Can you provide a link to the page in question please?  There is more than one way to create a modal dialogue box in javascript.
Title: Re: accessing parent window of the modal dialog bo
Post by: dmjpro on March 15, 2007, 03:27:09 AM
sooryy for late response .....

my code is something like this ....

the JS code of parent window....

//Some code
window.showModalDialog(URL);

the JS code of modal dialog window

//Some code ...
here i want to access the parent window without sending the window_ref as dialog_wrgs
here i can't access the parent window using window.opener

here what should i insert code to access the parent window


plz help me out .. i m struggling out for a 10-15 days

thanxxxxxx in advance
Title: Re: accessing parent window of the modal dialog bo
Post by: Rob Pomeroy on March 15, 2007, 04:21:45 AM
The first thing you need to know is that showModalDialog() is not cross-browser compatible, and therefore its use should be avoided.  What you are attempting will not work in Firefox, for example.

That said, you are correct in thinking that this kind of modal dialog box does not automatically have access to the parent window.  You need to pass a reference to the parent like this:

Code: [Select]
window.showModalDialog( 'modalwindow.html', window, '');Then in the modal box you can use:

Code: [Select]
var parentwin = window.dialogArguments;
Title: Re: accessing parent window of the modal dialog bo
Post by: dmjpro on March 15, 2007, 04:45:24 AM
our client uses the IE so there is no cross browser compatibility checking....

so without sending args from parent window i can't access the parent window anyway ....??? right.....

ok thanx for ur reply
Title: Re: accessing parent window of the modal dialog bo
Post by: Rob Pomeroy on March 15, 2007, 06:17:58 AM
Quote
so without sending args from parent window i can't access the parent window anyway ....??? right.....
That's certainly my understanding.  But as I said, there are other forms of (cross-browser compatible) modal dialogues that might provide more functionality.
Title: Re: accessing parent window of the modal dialog bo
Post by: dmjpro on March 15, 2007, 11:12:32 PM
thanx for ur details .....

hellooo Rob Pomeroy if u r free then plz answer my question .... thanxx a lot for ur  guidance for a last three dayssss


have a good day
Title: Re: accessing parent window of the modal dialog bo
Post by: Rob Pomeroy on March 16, 2007, 04:28:42 PM
Quote
if u r free then plz answer my question
Okay.  Which question is that?
Title: Re: accessing parent window of the modal dialog bo
Post by: dmjpro on March 18, 2007, 10:45:06 PM
actually what i post to this forums .....

have a good day
Title: Re: accessing parent window of the modal dialog bo
Post by: Rob Pomeroy on March 19, 2007, 09:49:13 AM
I think I've answered all the ones I've seen, that I can answer, but let me know if I missed one.  :)
Title: Re: accessing parent window of the modal dialog bo
Post by: dmjpro on March 19, 2007, 11:00:06 PM
ok thanxxx