By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,272 Members | 1,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,272 IT Pros & Developers. It's quick & easy.

Modal window and the return value

P: n/a
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;re sizable: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>
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.
--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET
"Lee" <ro****@yahoo.com>
??????:68**************************@posting.google .com...
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;re sizable: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>


Jul 19 '05 #2

P: n/a
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" <ro****@yahoo.com> wrote in message
news:68**************************@posting.google.c om...
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;re sizable: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>

Jul 19 '05 #3

P: n/a


If I move the iFrame to the same domain can the window it is calling
(src) be in another domain? I still have to figure a way to pull the
data back from the modal window in the other domain. Any thoughts?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4

P: n/a
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" <no***********@safeco.com> wrote in message news:<#C**************@TK2MSFTNGP12.phx.gbl>...
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" <ro****@yahoo.com> wrote in message
news:68**************************@posting.google.c om...
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;re sizable: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>

Jul 19 '05 #5

P: n/a
"Lee" <ro****@yahoo.com> wrote in message
news:68**************************@posting.google.c om...
: 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;re sizable: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
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.