Friday, March 16, 2012

Modal window and the return value

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;res
izable: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>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" <romax2@.yahoo.com>
':6847f7de.0407271241.3cc019f9@.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;res
izable: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://pics.10026.com/?src=http://..../default.asp" Style="HEIGHT: 10in; WIDTH: 10in;
> MARGIN=0" SCROLLING="no" ></IFRAME></TD>
> </TR>
> </table>
> </body>
> </html>
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" <romax2@.yahoo.com> wrote in message
news:6847f7de.0407271241.3cc019f9@.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;res
izable: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://pics.10026.com/?src=http://..../default.asp" Style="HEIGHT: 10in; WIDTH: 10in;
> MARGIN=0" SCROLLING="no" ></IFRAME></TD>
> </TR>
> </table>
> </body>
> </html>
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" <nospam_brubar@.safeco.com> wrote in message news:<#CyAvcCdEHA.1672@.TK2MSFTNG
P12.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" <romax2@.yahoo.com> wrote in message
> news:6847f7de.0407271241.3cc019f9@.posting.google.com...
"Lee" <romax2@.yahoo.com> wrote in message
news:6847f7de.0407271241.3cc019f9@.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;res
izable: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://pics.10026.com/?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 t
o
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

0 comments:

Post a Comment