Returns the parameter string function Remove_arg_from_url (arg_name_removed) {//sets or gets the portion of the HREF attribute that follows the question mark. var url = window.location.search; var arr = []; var query_string = ""; if (Url.lastindexof ('? ') = = 0) {//intercept var arg_str = url.substr (Url.lastindexof ('? ') +1, url.length); if (Arg_str.indexof (' & ')! =-1) {var arr = arg_str.split (' & '); for (var i in arr) {if (arr[i].split (' = ') [0]! = arg_name_removed) {query_string = Quer Y_string + arr[i].split (' = ') [0] + "=" + arr[i].split (' = ') [1] + "&"; }} return Query_string.substr (0, query_string.length-1); The}}//regular match function Remove_arg_from_url (name) {///from the current URL, the string starting with the number//such as: Http://www.baidu.com/s?wd=baidu&cl=3 its Search is? wd=baidu&cl=3 var query_string = window.location.search.substr (1); If there are no parameters then return empty if (query_string! = undefined) {var reg = new RegExp (' (^|&) ' + name + ' = ([^&] *) (&|$) '); Return Query_string.replace (Reg, "); } return ';}
JS gets the URL and deletes the specified parameter