首页 > 编程语言 > 详细

javascript在html直接传值

时间:2017-08-16 17:58:35      阅读:222      评论:0      收藏:0      [点我收藏+]
    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"));

  技术分享

 

javascript在html直接传值

原文:http://www.cnblogs.com/WJ--NET/p/7374614.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!