通过name获取地址栏的值


//获取地址栏参数
function getQueryStringByName(name) {
    var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
    if (result == null || result.length < 1) {
        return "";
    }
    return result[1];
}

 

//调用:

id=getQueryStringByName("id");

posted on 2014-08-23 00:11  wycfcqt  阅读(143)  评论(1编辑  收藏  举报

导航