Although you can dynamically modify the url through get submitting post forms, if multiple buttons can be submitted in parallel, it is inevitable that there will be some inappropriate things to write multiple forms with roughly the same and some details. Therefore, it is thought of dynamically modifying the url through JS to achieve addition, deletion, and revision of the url.
<script>var LG=(function(lg){var objURL=function(url){this.ourl=url||window.location.href;this.href="";//?The previous part this.params={};//url parameter object this.jing="";//# and the subsequent part this.init();}//Analyze the url and get the url that is stored in the front.href, the parameters are parsed into this.params object, the # number and the following are stored in this.jingobjURL.prototype.init=function(){var str=this.ourl;var index=str.indexOf("#");if(index>0){this.jing=str.substr(index);str=str.substring(0,index);}index=str.indexOf("?");if(index>0){this.href=str.substring(0,index);str=str.substr(index+1);var parts=str.split("&");for(var i=0;i<parts.length;i++){var kv=parts[i].split("=");this.params[kv[0]]=kv[1];}}else{this.href=this.ourl;this.params={};}}//Just just modify this.paramsobjURL.prototype.set=function(key,val){this.params[key]=val;}//Just just set this.paramsobjURL.prototype.remove=function(key){this.params[key]=undefined;}//After making up the operation of three parts, urlobjURL.prototype.url=function(){var strurl=this.href;var objps=[];//There is an array organized here, and then the join operation is done for(var k in this.params){if(this.params[k]){objps.push(k+"="+this.params[k]);}}if(objps.length>0){strurl+="?"+objps.join("&");}if(this.jing.length>0){strurl+=this.jing;}return strurl;}//Get the parameter value objURL.prototype.get=function(key){return this.params[key];} lg.URL=objURL;return lg;}(LG||{}));var myurl=new LG.URL(window.location.href);myurl.remove("b"); //Delete balert(myurl.get ("a")); //Get the value of parameter a, and here we get 1myurl.set("a",23); //Modify the value of a to 23alert (myurl.url());</script>