Click to See Complete Forum and Search --> : arrayB = arrayA


kopite
04-06-2003, 09:50 AM
Hi,

How do I pass an array from func A to func B... the code below works okay within a single function:

var a = new Array()
var b = new Array(4,2,1);

a = b;

(a) My problem is how do I pass an array from one function to another function. Also, (b) how can I assign a = b across different pages ( I know that I can call a function in another page without problem, i.e. window.opener().myFunction(); )

thanks,

khalidali63
04-06-2003, 10:12 AM
Passing an object to a function

var array = new Array(1,2,3,4);

setArray(array);

now in the setArray function u can use the passed array

function setArray(param){
//at this point param containall the data that array has.
var newArr = param

//now newArr has all the data that param has.
}

Hope this helps


CHeers

Khalid

kopite
04-06-2003, 10:31 AM
:o

Thanks. On further examination I see that I had done a typo error.