标签:
<script>
var url = "baidu.com?";
//var url = window.location.search; //获取url
function getUrl(url) {
var obj = {},
arr = [],
temp = [];
arr = url.split("?")[1].split("&");
for (var i in arr) {
temp = arr[i].split("=");
obj[temp[0]] = temp[1];
}
return obj;
};
console.log(getUrl(url));
</script>
标签:
原文地址:http://www.cnblogs.com/mouse2417/p/5165610.html