js获取url?问号后面的参数

getQueryVariable(variable) {
                var query = window.location.search.substring(1);
                var vars = query.split("&");
                for (var i = 0; i < vars.length; i++) {
                    var pair = vars[i].split("=");
                    if (pair[0] == variable) {
                        return pair[1];
                    }
                }
                return (false);
            },

 

posted @ 2020-12-09 10:28  秃头的铲屎官  Views(1123)  Comments(0Edit  收藏  举报