首页 > 技术文章 > GetParam(name)

sntetwt 2014-07-08 09:17 原文

 function GetParam(name) {
            var match = new RegExp(name +  
                "=*([^&]+)*", "i").exec(location.search);   
            if (match == null)             
                match = new RegExp(name + "=(.+)", "i").exec(location.search);  
            if (match == null) return null;             
                match = match + "";           
            //**convert match to a string       
            result = match.split(",");          
            return decodeURIComponent(result[1]);     
        } 

 

推荐阅读