js 为url字符串添加、修改参数
//为url字符串添加、修改参数 String.prototype.EditUrlParam = function (paramName, replaceWith) { var url = this; if (url.indexOf(paramName) > -1) { var re = eval('/(' + paramName + '=)([^&]*)/gi'); url = url.replace(re, paramName + '=' + replaceWith); } else { var paraStr = paramName + '=' + replaceWith; var idx = url.indexOf('?'); if (idx < 0) url += '?'; else if (idx >= 0 && idx != url.length - 1) url += '&'; url=url + paraStr; } return url; };