遇到一次需要对url进行解析来获得里面带的参数,比如:
url=http://window?key0=0&key1=1&key2=2;
var url="http://window?key0=0&key1=1&key2=2";
function getdata(){
var obj={};
var a=url.spilt('?');
var b=a[1].spilt('&');
for(var i=0i<b.length;i++){
var c=b[i].spilt('=');
obj[c[0]]=c[1];
}
return obj;
}