deal with href remove the same element

云海梦尘 2011-05-11

varurl="http://zhidao.baidu.com/question/193641504.html?name=tom&age=28";

functiongetName(url,name){

varfirstarr=url.split("?");

varsecarr=firstarr[1].split("&");

varthirdarr=[];

for(vari=0;i<secarr.length;i++){

thirdarr[i]=secarr[i].split("=");

}

for(varj=0;j<thirdarr.length;j++){

if(thirdarr[j][0]==name){

returnthirdarr[j][1];

}

}

returnfalse;

}

//varmyvalue=getName(url,"name");

//document.write(myvalue);

varduplicatedarr=[1,2,3,"a","b","e","a",7,8,3,"s","b","e","d",4,7,3];

functionremoveduplicateitem(arr){

for(vari=0;i<arr.length;i++){

for(varj=i+1;j<arr.length;j++){

if(arr[i]==arr[j]){

//deletearr[j];

arr.splice(j,1);

}

}

}

returnarr;

}

相关推荐

wcqwcq / 0评论 2015-12-22