//假设ulr如下var localhost="http://127.0.0.1?name=tom&sex=男&id=1";//正则方法封装function GetQueryString(name){ var reg = new RegExp("(^|)"+ name +"=([^&]*)(&|$)"); var r = localhost.substr(1).match(reg); if(r!=null)retu…
/** * 获取URL中指定参数的值 * * @param name 参数名称 * @returns */ function getQueryString(name) { var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } r…
$(function () { var action = getUrlParam("action"); alert(action) }); //根据URL中的参数获取值 function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).ma…