SOURCE

function getUrlParam(sUrl, sKey) {
    var result = {}
    var url = sUrl.slice(sUrl.indexOf('?')+1,sUrl.length).split('&')
    for(let i = 0;i<url.length;i++){
        var a = url[i].split('=')
        if(result[a[0]] != undefined&&typeof result[a[0]]!='object'){
            if(a[1].indexOf('#')!=-1){
                a[1] = a[1].slice(0,a[1].indexOf('#')-1)
            }
            let o = []
            o.push(result[a[0]])
            result[a[0]] = o
            result[a[0]].push(a[1])
        }else if(result[a[0]] != undefined&&typeof result[a[0]]=='object'){
            if(a[1].indexOf('#')!=-1){
                a[1] = a[1].slice(0,a[1].indexOf('#')-1)
            }
            result[a[0]].push(a[1])
        }else{
            //console.log(a[1])
            if(a[1].indexOf('#')!=-1){
                var aaa
                if(a[1].indexOf('#')==1){
                    aaa = a[1].charAt(0)
                }
                a[1] = a[1].slice(0,a[1].indexOf('#')-1)
                //console.log(aaa)
                result[a[0]] = aaa
            }else{
                result[a[0]] = a[1]
            }
        }
    }
    if(sKey == null){
        return result
    }else{
        if(result[sKey]==undefined){
            return ''
        }else{
            return result[sKey]
        }
    }
    //console.log(result[sKey])
}
console 命令行工具 X clear

                    
>
console