Although the URL can be dynamically modified by submitting the post form in a get way, but if more than one button can be submitted in parallel, write a number of roughly the same, and some details of the difference between the form, it is inevitable that some improper, so think of the dynamic through JS to modify the URL, to achieve the URL additions and deletions to check the changes.
<script> var lg= (function (LG) {var objurl=function (URL) {this.ourl=url| |
Window.location.href;
This.href= ""; the previous section This.params={};//url parameter Object this.jing= "";//#及后面部分 this.init (); }//Parse URL, get? Before saving this.href, parameter resolves to this.params object, #号及后面存入this. Jing objurl.prototype.init=function () {var str=this.o
Url
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={};
}//Only modifies 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 after the three-part operation; var objps=[];//here is organized with arrays, then join operations 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 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 the B alert (Myurl.get ("a"));//Take the value of parameter A, here get 1 myurl.set ("a", 23);
Modify the value of a to alert (Myurl.url ()); </script>