/** * 参数 * @type {Object} */ var Param = { // 获取所有参数,返回Object类型,然后根据参数名获取对应的参数值 urlArgs :function(){ var url = location.search, // 参数 str = '', params = {}; if(url.indexOf('?') != -1){ str = url.substr(1); }else{ return null; } strs = str.split('&'); for(var i = 0; i < strs.length; i++){ var sub = strs[i].split('='); params[sub[0]] = unescape(sub[1]); } return params; } }