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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

openModalDialog problem? 1

Status
Not open for further replies.

rhowes

IS-IT--Management
Jun 6, 2001
140
ZA
Hi

Does anyone know how I set "returnValue" in my page that I load into a showModalDialog window. The documentation says I can set returnValue and read it in my page that creates the modal dialog but does not say how to set it.

Thanks in advance.
Cheers,

Richard
 
Hi,

Just add a line of JavaScript in your Modal Window Page:

window.returnValue = 'your_return_value';

Fiendy
 
Hi Fiendy

Thank you - problem solved. Interestingly I also had to add the javascript function call to my <img> tag onclick event as it does not work in a modal dialog like this:

<a href=&quot;javascript:setReturnValue()&quot; ...

Any idea why this is?

Thanks again,

Richard
 
Hi,

Glad it helped :)

As for the link, try :-

<A HREF=&quot;#&quot; onclick=&quot;setReturnValue()&quot;>

instead.

I think it is trying to execute the JS code in the parent window when you call it in the HREF, which, of course it can't as it's 'frozen' whilst your Modal window is open.
I'd not come across this before but I generally do my links as above or use buttons/images.

Fiendy.
 
Hi,

Thanks again - makes sense and using the onclick event in the <A HREF...> tag seems &quot;neater&quot; anyway. I'll use that from now on.

Cheers,
Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top