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()];
    }
原文地址:https://www.cnblogs.com/langu/p/3487089.html