标签:reg try param sea blog ges null exp mat
    function getUrlParam(url, name) {
        var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g");
        var matcher = pattern.exec(url);
        var items = null;
        if (matcher != null) {
            try {
                items = decodeURIComponent(decodeURIComponent(matcher[1]));
            } catch (e) {
                try {
                    items = decodeURIComponent(matcher[1]);
                } catch (e) {
                    items = matcher[1];
                }
            }
        }
        return items;
    }
 console.log(getUrlParam(window.location.search, "customerid"));
  
标签:reg try param sea blog ges null exp mat
原文地址:http://www.cnblogs.com/WJ--NET/p/7374614.html