js解析地址栏参数
/** * 获取地址栏中url后面拼接的参数 * eg: * 浏览器地址栏中的地址:http://1.1.1.1/test.html?owner=2db08226-e2fa-426c-91a1-66e26f62c13f&view=pc * var param=location.search;//?owner=2db08226-e2fa-426c-91a1-66e26f62c13f&view=pc * var ownerId = getUrlParam("owner",param); * var view = getUrlParam("view",param); */ function getUrlParam(name,param) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = param.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }