我有一个javascript:
var a=camera.getDetails();// (say a=["1","2"] as arraylist/array)
var c=new Array(a);
alert(c);
window.location="my_details.html?"+c.join(",")+ "_";
在my_details.html中:
var q=window.location.search;
alert("qqqqqqqqqqqqq " + q);
var arrayList = (q)? q.substring(1).split("_"):[];
//arrayList=arrayList.split("%20");
var list=new Array(arrayList);
var s=decodeURIComponent(list).split(",");
//var str=s.split(",");
var a=s[5];
alert("dataaaaaaaaaaaaaaa " + s + "kkkllll "+ a + "jgkjhgjk" );
我想从]
数组值中删除此s[5]
字符,并从[
中删除s[0]
字符。
答案 0 :(得分:0)
仅在修剪大括号后将字符串拆分为数组。
var decoded = "[100, 200, 300, 400, 500]";
decoded = decoded.replace(/\[/, "");
decoded = decoded.replace(/\]/, "");
var s = decoded.split(",");