//url:地址;arg:要变更的参数名;arg_val:要变更的参数值
function changeURLArg(url,arg,arg_val){
var pattern=arg+'=([^&]*)';
var replaceText=arg+'='+arg_val;
if(url.match(pattern)){
var tmp='/('+ arg+'=)([^&]*)/gi';
tmp=url.replace(eval(tmp),replaceText);
return tmp;
}else{
if(url.match('[?]')){
return url+'&'+replaceText;
}else{
return url+'?'+replaceText;
}
}
return url+'
'+arg+'
'+arg_val;
}
})
//原博客地址:http://blog.csdn.net/dxy_fly/article/details/70256655