以下是随便写的例子。
1.字符串转二维数组
var a="[['1','2','3','4','5'],['a','b','c','d','e'],['y1','y2','y3','y4','y5']] ";
var str=eval(a);
alert(str[0][3]);
//结果:4
2.二维数组转字符串
var b=[['1','2'],['a','b']];
function getString( objarr ){
var typeNO = ;
var tree = "[";
for (var i = 0 ;i < typeNO ; i++){
tree += "[";
tree +="'"+ objarr[i][0]+"',";
tree +="'"+ objarr[i][1]+"'";
tree += "]";
if(i
tree+=",";
}
}
tree+="]";
return tree;
}
alert(getString(b));
//结果:"[['1','2'],['a','b']] "