js获取url查询参数

    function getURLParamInfo(key) {
        if (location.search == "") { return undefined; }
        var a = location.search;
        a = a.replaceAll('=', '\":\"');
        a = a.replaceAll('&', '\",\"');
        a = a.replace('?', '{\"');
        a += "\"}"
        var b = eval('(' + a.toLowerCase() + ')');
        return b[key.toString().toLowerCase()];
    }

 

你可能感兴趣的:(url)