js获取url中参数

js方法

function getParameterValue(url) {
    var result = location.search.match(new RegExp("[?&]" + url + "=([^&]+)","i"));
    if (result == null || result.length < 1){
        return "";
    }else {
        return result[1];
    }
}
原文地址:https://www.cnblogs.com/cailijuan/p/10563515.html