window.getRequest = function (url) { var theRequest = new Object(); var indexOf = url.indexOf("?"); if (indexOf > -1) { var str = url.substr(indexOf + 1); var strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); } } return theRequest; };
调用代码
var str = getRequest("http://ShsbView.html?S_ID=xx&U_ID=zz");