/** * 获取url中得参数 * @param name * @returns {null} */ window.getQueryString = function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }
example: getQueryString(id);//可以获得id传递的参数;