js获取url中的参数
function getUrlParam(strUrl) { var url, pos, urlStr, para; url = strUrl || window.location.href; pos = url.indexOf("?") if(pos <= 0) return; url = url.substring(pos + 1); var params = url.split("&"); if(params == null || params.length == 0) return; var paramsObj = {}; for(var i = 0; i < params.length; i++) { var keyvalue = params[i].split("="); paramsObj[keyvalue[0]] = decodeURIComponent(keyvalue[1]); } return paramsObj }
吾乃代码搬运工,侵联删