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? Front deposit This.href, parameter resolves to a This.params object, #号及后面存入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;}//Only set This.params Objurl.prototype.remove=function (key) {this.params[key]=undefined}//The URL after the three-part operation Objurl.prototype.url=
The function () {var strurl=this.href var objps=[];//is organized here with an array, then a 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 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>