var str='http://www.baidu.com/?ie=utf-8&f=3&rsv_bp=1&tn=baidu&wd=abc&rsv_enter=0&rsv_sug3=3&rsv_sug4=159&rsv_sug1=2&rsp=0&inputT=3610'; var arr=str.split('?')[1].split('&'); var res={}; for(var i=0; i<arr.length;i++){ var str2 = arr[i].split('='); res[str2[0]]=str2[1]; } console.log(res)