标签:href tostring eva ati 地址 stat 替换 数据 span
//获取替换url参数后的url数据 function GetReplaceUrl(paramName, replaceWith) { var oUrl = this.location.href.toString(); var re = eval(‘/(‘ + paramName + ‘=)([^&]*)/gi‘); var nUrl = oUrl.replace(re, paramName + ‘=‘ + replaceWith); return nUrl; }; //替换url不刷新 function ReplaceUrl(paramName, replaceWith) { window.history.replaceState(null, null, GetReplaceUrl(paramName, replaceWith)); };
ReplaceUrl("id", 3);
将url中id替换为3
标签:href tostring eva ati 地址 stat 替换 数据 span
原文地址:https://www.cnblogs.com/zhaogaojian/p/11063785.html