//注意url中要含? function getParameterByName(name, url) { if (!url) { url = window.location.href; } name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + n…
js获取url参数的方法有很多. 1.正则分析 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]); retur…
function getParam(key) { var tmp = location.search; tmp = decodeURIComponent(tmp); var index = tmp.indexOf(key); var length = key.length; var value; if(index != -1){ var start = index+length+1; var end = tmp.indexOf('&',start); if(end == -1){ value =…
获取指定url参数值 /* 获取某url中的某参数值 调用:GetUrlQueryString("[url地址]","[参数名]"); */ function GetUrlQueryString(url,name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = url.substring(url.indexOf("…
一.js修改地址栏URL参数 function changeURLPar(destiny, par, par_value) { var pattern = par + '=([^&]*)'; var replaceText = par + '=' + par_value; if (destiny.match(pattern)) { var tmp = '/\\' + par + '=[^&]*/'; tmp = destiny.replace(eval(tmp), replaceText)…