snakehips2000
Programmer
I've got problems with the following JavaScript code. Although the array is seemingly created, I'm unable to access the individual elements (in this case, the first one 'uno'). Instead the browser displays the whole array, i.e. 'uno', 'dos', 'tres'. When I replace "document.writeln(arr2[0]);" with "document.writeln(arr2[1]);" I receive "undefined":
<script language = "Javascript">
function DuplicateRows(arry) {
var str=arry.substring(1, arry.length-1);
var arr2=new Array(str.split(","));
document.writeln(arr2[0]);
}
DuplicateRows("~'uno', 'dos', 'tres'~");
</script>
Any help much appreciated.
<script language = "Javascript">
function DuplicateRows(arry) {
var str=arry.substring(1, arry.length-1);
var arr2=new Array(str.split(","));
document.writeln(arr2[0]);
}
DuplicateRows("~'uno', 'dos', 'tres'~");
</script>
Any help much appreciated.