function replaceParamVal(oldUrl, paramName, replaceWith) {
var re = eval(‘/(‘ + paramName + ‘=)([^&]*)/gi’);
var nUrl = oldUrl.replace(re, paramName + ‘=’ + replaceWith);
return nUrl;
}
function hasParameter(name){
var reg = new RegExp(“(^|&)” + name + “=([^&]*)(&|$)”);
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
评论回复