well this is how you make an array in javascript
Code:
var myArray = new Array("string1","string2","string3");
this will make an array with 3 indices (0,1,2). Notice how each string I have is surrounded by quotations and is followed by a comma. the quotations mark the boundaries of the string you are putting into the array and the comma marks that it is adding another string. Both quotations and comma are needed in order to build an array like this.
from you sample code
var myArray2= new Array('<s:property value="%{arr}"/>');
it doesn't seem like this is happening. I don't know what "<s:property value="%{arr}"/>" is but at best this will only produce an array with 1 index and that doesn't seem to be the result you want.
if you have an existing array in some server side language and you want to build a client-side array in javascript you will need to use a loop to do so. the loop will loop through the elements of the array on the server side to populate the code for the client side. To build an array like the above code you will have to follow something like this:
Code:
var myArray = new Array("
<start server side code>
start loop
output array value here surrounded by quotations
if its not the last index of the array add a comma
end loop
</end server side code>
");
something like that is going to get the results of something like this...
Code:
var myArray = new Array("value1","value2","value3","value4","value5");
...and it will build your array.
there are other methods to make javascript arrays too. for example you can declare the array then add values at the index you want.
Code:
var myArray = new Array();
myArray[0] = "value1";
myArray[1] = "value2";
myArray[2] = "value3";
myArray[3] = "value4";
myArray[4] = "value5";
or you can use the array push method to throw values and it will dynamically grow the array like this:
Code:
var myArray = new Array();
myArray.push("value1");
myArray.push("value2");
myArray.push("value3");
myArray.push("value4");
myArray.push("value5");
im sure there are other creative ways as well to make an array and you can use which ever method you find easiest to work with when looping through a server side language to make client-side syntax.
javascript will only understand javascript code so you need to output what it understands to make what you want work.