function searchParse(){
var resultObj = {}; var search = window.location.search; if(search && search.length > 1){ var search = search.substring(1); var items = search.split('&'); for(var index = 0 ; index < items.length ; index++ ){ if(! items[index]){ continue; } var kv = items[index].split('='); resultObj[kv[0]] = typeof kv[1] === "undefined" ? "":kv[1]; } } return resultObj; }//Sample Code
//Url:http://localhost/default.aspx?a=hello&b=kt&c=group
var searchObj = searchParse();
var a = searchObj["a"]; //a==hello
var b = searchObj["b"]; //b== kt
var c = searchObj["c"]; //c== group
转载于:https://www.cnblogs.com/ktgroup/archive/2010/02/08/1666056.html