There are many improper methods to dynamically modify the url by submitting the post form in get mode. Therefore, I thought of using JS to dynamically modify the url, to add, query, modify, and delete a url. Although you can dynamically modify the url by submitting a post form using the get method, if multiple buttons can be submitted in parallel, multiple write operations are roughly the same, there are also forms with some differences in details, which are difficult to avoid. Therefore, I thought of using JS to dynamically modify the url to add, query, modify, and delete the url.
Script var LG = (function (lg) {var objURL = function (url) {this. ourl = url | window. location. href; this. href = "";//? Previous section this. params = {}; // url parameter object this. jing = ""; // # And this. init ();} // analyze the url? Save this. href. The parameter is resolved to this. params object, # And save it to 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
0) {strurl + = this. jing;} return strurl;} // obtain 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"); // The balert (myurl. get ("a"); // obtain the value of parameter a. Here, we get 1myurl. set ("a", 23); // modify the value of a to 23 alert (myurl. url (); script