|
August 27, 2001 Passing an Array to the Dialog Box Tips: August 2001
Yehuda Shiran, Ph.D.
|
|
When passing a parameter by value to the dialog box, the callee can only read the passed parameter, but cannot change it in the caller page. In order to be able to change the caller, you need to pass the parameter by reference. You do this when you pass the address of a variable. There are at least two ways to pass addresses: an array and an object. Let's demonstrate the array passing. In this page (the caller), we define an array a as follows:
And we pass the array
The callee 010827a.html includes the following 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
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.
People who read this tip also read these tips: Look for similar tips by subject: |