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()];
    }

 

posted @ 2013-12-23 11:14  二师弟tl  阅读(946)  评论(0编辑  收藏  举报