My problem is to allow ASP to interact with JSP, and I pass JavaScript
object in my approach,
but I wonder if it will work in network, not just in local machine.
For testing purposes, the following are page1.html and page2.html that use
Array JavaScript object
to pass data back and forth. page1.html is able to
transfer data to page2.html, but page2.html has trouble to transfer data
back to page1.html.
I am now using
args["fname"] = document.InputForm.fname.value;
window.returnValue = args;
to pass data back to page1.html, but still not working. Any ideas??
Please advise the correct approach to my problem! Thanks!
----------------------------------------------------------------------------
--------------------
//page1.html
<html>
<head>
<script type="text/javascript">
function openwindow()
{
var args = new Array();
args["fname"] = document.InputForm.fname.value;
var sReturn = window.showModalDialog("page2.html", args,
"dialogHeight:700px; dialogWidth:500px;");
alert("window.returnValue = " + window.returnValue);
}
</script>
</head>
<body>
<H2>Page 1</H2>
<form name="InputForm">
<P>name: <input type="text" name="fname">
<P><input type="button" value="validate" onclick="openwindow()">
</form>
</body>
</html>
----------------------------------------------------------------------------
--------------------
//page2.html
<html>
<head>
<script type="text/javascript">
var args = window.dialogArguments;
function window_onload()
{
document.InputForm.fname.value = args["fname"];
}
function OK()
{
args["fname"] = document.InputForm.fname.value;
alert("args = " + args); //empty!!
window.returnValue = args;
window.close();
}
</script>
</head>
<H2>Page 2</H2>
<body onload="window_onload()">
<form name="InputForm">
<P>name: <input type="text" name="fname">
<P><input type="button" value="validate" onClick="OK()">
</form>
</body>
</html>