/*获取请求参数 */ (function($) { $.getUrlParam = function(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return decodeURIComponent(r[2]); return null; }; })(jQuery); function urlSearchObj() { var url = "" + (arguments[0] || window.location.search), _url; if (url.indexOf("?") !== 0) { return {}; } _url = decodeURI(url.slice(1)); var _s = _url.split("&"); var d = {}; for (var i = 0; i < _s.length; i++) { var _v = _s[i].split("="); if(_v[0] === 'id' && _v[1].indexOf('!') !== -1){ d[_v[0]] = _v[1].slice(0,-1); }else { d[_v[0]] = _v[1]; } } return d; }
本文转自 小旭依然 51CTO博客,原文链接:http://blog.51cto.com/xuyran/1866683