August 27, 2001 - Passing an Array to the Dialog Box
August 27, 2001 Passing an Array to the Dialog Box Tips: August 2001
Yehuda Shiran, Ph.D.
|
a
as follows:
<SCRIPT LANGUAGE="JavaScript">
<!--
var a = new Array;
a[0]="first";
a[1]="second";
a[2]="third";
// -->
</SCRIPT>
And we pass the array a
to the dialog box:
window.showModelessDialog('010827a.html',a);
The callee 010827a.html includes the following script:
<SCRIPT LANGUAGE="JavaScript">
<!--
a = dialogArguments;
a[0] = "fourth";
// -->
</SCRIPT>
The callee changed the first element of the array and it should be reflected in the caller page. Let's try it. First, let's make sure the array a
is as we initialized it: "first,second,third"
. Now, call 010827a.html
to change it:
window.showModelessDialog('010827a.html',a);
Notice how we pass the array a
as the second argument of showModelessDialog()
. Feel free to close the dialog box. The dialog box already modified a[0]
, so you should see a modified array: "fourth,second,third"
.For more on modal and modeless dialog boxes, go to Column 90, Modal and Modeless Dialog Boxes.