获取页面路径中的参数

getvalue:function(name) {
                var str = window.location.search; 
                if(str.indexOf(name) != -1) {
                    var pos_start = str.indexOf(name) + name.length + 1;
                    var pos_end = str.indexOf("&", pos_start);
                    if(pos_end == -1) {
                        return str.substring(pos_start);
                    } else if(pos_end > 0) {
                        return str.substring(pos_start, pos_end);
                    } else {
                        return "";
                    }
                }
            }
  var id = 'id',p_id='p_id',level='level'
            this.level = this.getvalue(level)

            if(this.level==3){
                this.p_id = this.getvalue(p_id)//二级id
                this.ids = this.getvalue(id)//三级id
                this.checkAllFlag = true
            }else if(this.level==4){
                this.p_id = this.getvalue(p_id)//三级id
                this.ids = this.getvalue(id)//四级id
            }

  

  

原文地址:https://www.cnblogs.com/xiaohuohuai/p/13712127.html