Urgent :: Return parameters from modal child window to parent window using javascript

I want  a way to Return parameters from modal child window to parent window using javascript

the modal window opened using (showModalDialog)

Please advice  ASAP

amr_swgAsked:
Who is Participating?
 
DarthModCommented:
PAQed with points (500) refunded

DarthMod
Community Support Moderator
0
 
william007Commented:
Modal Parent Window(Opener.htm)
<html>
<head>
<script>
var a;
function openwindow(){
a=window.showModalDialog("open.htm",window);
document.getElementById("txt").value=a;
}
</script>
<head>
<body>
<input type="text" id="txt"/>
<input type="button" onclick="openwindow()" value="openDialog"/>
<input type="button" onclick="javascript:alert(a);"
value="showValue"/>
</body>
<html>

Modal Child Window(Open.htm)
<html>
<head>
<script>
function closeandsend(){
window.returnValue=document.getElementById("txt1").value;
window.close();
}
</script>
<head>
<body>
<input type="text" id="txt1"/>
<input type="button" onclick="closeandsend()" value="closeandsend">
</body>
<html>
0
 
william007Commented:
By the way, COBOLdinosaur, thanks for your remind.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
william007Commented:
By the way, COBOLdinosaur, is it possible to remove your comment from the profile as I as unaware of this...
0
 
william007Commented:
Very thanks, COBOLdinosaur, you are so considerate.
0
 
amr_swgAuthor Commented:
Dear all

The problem solved as follows

In parent window

window.showModalDialog('URL',self,'options');
 

in child window

<script>
opener = window.dialogArguments;
</script>

opener.document.getElementById('xx').value= val1
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.