function getKeyValue(url) { var result = {}; var reg = new RegExp('([\\?|&])(.+?)=([^&?]*)', 'ig'); var arr = reg.exec(url); while (arr) { result[arr[2]] = arr[3]; arr = reg.exec(url); } return result; }