码迷,mamicode.com
首页 > Web开发 > 详细

js 替换 当前URL 特定参数

时间:2014-07-16 14:41:56      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   os   io   cti   

js 替换 当前URL 特定参数  

2012-12-24 20:45:53|  分类: JS&JQuery |举报 |字号 订阅

 
//替换指定传入参数的值,paramName为参数,replaceWith为新值
function replaceParamVal(paramName,replaceWith) {
    var oUrl = this.location.href.toString();
    var re=eval(‘/(‘+ paramName+‘=)([^&]*)/gi‘);
    var nUrl = oUrl.replace(re,paramName+‘=‘+replaceWith);
    this.location = nUrl;
}

js 替换 当前URL 特定参数,布布扣,bubuko.com

js 替换 当前URL 特定参数

标签:style   blog   http   os   io   cti   

原文地址:http://www.cnblogs.com/afei-happy/p/3848414.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!