Modal window and the return value

L

Lee

I am using a modal window and an iFrame to try and pull a return value
back. I am doing this across domains.

I have the value returned from the modal window to the iFrame window
but I can not get the value returned to the parent window. The alert
in the parent window always returns undefined errors. Any help would
be much appreciated.

I call the modal window and wait for the return as such:
function LCC()
{
var aUrl = "http://.../IFrame.html";
sFeatures="dialogHeight:600px;dialogWidth:850px;resizable:yes;center:yes"
LCV = window.showModalDialog(aUrl,"",sFeatures);
alert(LCV);

}
</script>

Here is the iFrame:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

</head>
<script>
function onunloadevent(){

parent.window.returnValue = window.frames[0].aValue.innerText;
alert(window.returnValue);
}
</script>

<body onunload='onunloadevent();'>
<TABLE align='left' border='0'>
<TR>
<TD align='center'><IFRAME frameborder='0'id="Frame1"
src="http://...../default.asp" Style="HEIGHT: 10in; WIDTH: 10in;
MARGIN=0" SCROLLING="no" ></IFRAME></TD>
</TR>
</table>
</body>
</html>
 
J

Juno

Hi,

try this:
<script>
function onunloadevent(){

window.returnValue = window.frames[0].aValue.innerText;
alert(window.returnValue);
}
</script>

I think you are supposed to alert(window.frames[0].aValue.innerText) first
to find out if you have got its value.
 
B

bruce barker

the following code will fail if the iframe is not the same domain as the
host frame

parent.window.returnValue = window.frames[0].aValue.innerText;

-- bruce (sqlwork.com)
 
L

Lee

How do I return values from another domain. I have to call out to
this other domain to run the ASP pages. Then pass them back to the
parent window. I would really like to use the modal window because it
functions just like I would want it to. I tried moving the iFrame to
the parent domain but then recieved a permission denied error.

Any thoughts?

bruce barker said:
the following code will fail if the iframe is not the same domain as the
host frame

parent.window.returnValue = window.frames[0].aValue.innerText;

-- bruce (sqlwork.com)




Lee said:
I am using a modal window and an iFrame to try and pull a return value
back. I am doing this across domains.

I have the value returned from the modal window to the iFrame window
but I can not get the value returned to the parent window. The alert
in the parent window always returns undefined errors. Any help would
be much appreciated.

I call the modal window and wait for the return as such:
function LCC()
{
var aUrl = "http://.../IFrame.html";
sFeatures="dialogHeight:600px;dialogWidth:850px;resizable:yes;center:yes"
LCV = window.showModalDialog(aUrl,"",sFeatures);
alert(LCV);

}
</script>

Here is the iFrame:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

</head>
<script>
function onunloadevent(){

parent.window.returnValue = window.frames[0].aValue.innerText;
alert(window.returnValue);
}
</script>

<body onunload='onunloadevent();'>
<TABLE align='left' border='0'>
<TR>
<TD align='center'><IFRAME frameborder='0'id="Frame1"
src="http://...../default.asp" Style="HEIGHT: 10in; WIDTH: 10in;
MARGIN=0" SCROLLING="no" ></IFRAME></TD>
</TR>
</table>
</body>
</html>
 
R

Roland Hall

: I am using a modal window and an iFrame to try and pull a return value
: back. I am doing this across domains.
:
: I have the value returned from the modal window to the iFrame window
: but I can not get the value returned to the parent window. The alert
: in the parent window always returns undefined errors. Any help would
: be much appreciated.
:
: I call the modal window and wait for the return as such:
: function LCC()
: {
: var aUrl = "http://.../IFrame.html";
: sFeatures="dialogHeight:600px;dialogWidth:850px;resizable:yes;center:yes"
: LCV = window.showModalDialog(aUrl,"",sFeatures);
: alert(LCV);
:
: }
: </script>
:
: Here is the iFrame:
: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
: <html>
: <head>
: <title>Untitled Document</title>
: <meta http-equiv="Content-Type" content="text/html;
: charset=iso-8859-1">
:
: </head>
: <script>
: function onunloadevent(){
:
: parent.window.returnValue = window.frames[0].aValue.innerText;
: alert(window.returnValue);
: }
: </script>
:
: <body onunload='onunloadevent();'>
: <TABLE align='left' border='0'>
: <TR>
: <TD align='center'><IFRAME frameborder='0'id="Frame1"
: src="http://...../default.asp" Style="HEIGHT: 10in; WIDTH: 10in;
: MARGIN=0" SCROLLING="no" ></IFRAME></TD>
: </TR>
: </table>
: </body>
: </html>

Lee... You might get more help in a different group. Loading an .asp file
in an iframe doesn't require asp coding. You've sent this message to two
groups which conflict with each other. This also does not appear to be a
..NET app. Perhaps an HTML or J(ava)script group might be more beneficial to
you.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top