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 previous part this.href, the parameter is parsed into this.params object, # number and subsequently stored in this.jing objURL.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 modify this.params objURL.prototype.set=function(key,val){ this.params[key]=val; } //Just set this.params objURL.prototype.remove=function(key){ this.params[key]=undefined; } //The url objURL.prototype.url=function(){ var strurl=this.href; var objps=[];//There is an array here and do the join operation 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"); //Remove b alert(myurl.get ("a")); //Get the value of parameter a, and here you get 1 myurl.set("a",23); //Modify the value of a to 23 alert (myurl.url()); </script>