var strUrl="http:baidu.com/stu/?lx=1&name=aa&sex=man"; var s=strUrl.indexOf('?'); var strs=strUrl.slice(s+1); var strAry=strs.split('&'); var objs={}; for(var i=0;i<strAry.length;i++){ var item=strAry[i]; var itemAry=item.split('='), itemAryl=itemAry[0], itemAryr=itemAry[1]; objs[itemAryl]=itemAryr; } console.log(objs);//{lx: "1", name: "aa", sex: "man"}