<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="智能社 - zhinengshe.com">
<meta name="copyright" content="智能社 - zhinengshe.com">
<title>智能社 - www.zhinengshe.com</title>
<script>
// http://baidu.com?name=harry&age=18&sex=1
/*
{
name: harry,
age:18,
sex:1
}
?name=harry&age=18&sex=1
name=harry&age=18&sex=1
name=harry
age=18
sex=1
*/
// var sSeach=window.location.search;
var sSeach='?name=harry&age=18&sex=1';
var url=sSeach.substring(1);
var arr=url.split('&');
var json={};
console.log(arr)
for(var i=0; i<arr.length;i++)
{
var aTmp=arr[i].split('=');
console.log(aTmp)
var name=aTmp[0];
var value=aTmp[1];
json[name]=value;
}
console.log(json)
alert(JSON.stringify(json));
</script>
</head>
<body>
</body>
</html>