杀人放火厉飞羽,万人敬仰韩天尊。|

WangJunZzz

园龄:9年3个月粉丝:99关注:13

javascript在html直接传值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
   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"));

  

 

本文作者:WangJunZzz

本文链接:https://www.cnblogs.com/WangJunZzz/p/7374614.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   WangJunZzz  阅读(444)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起