getUrlParam () parameter values acquired after the url address bar

Edit page write time, without introducing getUrlParam () js code, resulting in a URL parameter edit page can not obtain the address bar can not get the value, add the following js references like this.
<script type="text/javascript" src="/js/common.js"></script>

The following is getUrlParam () implementation code:

// Get the parameter value after the address bar url
function getUrlParam(key) {
   var href = window.location.href;
   var url = href.split("?");
   if(url.length <= 1){
      return "";
   }
   var params = url[1].split("&");
   
   for(var i=0; i<params.length; i++){
      var param = params[i].split("=");
      if(key == param[0]){
         return param[1];
      }
   }
}

Guess you like

Origin blog.csdn.net/XIAO_YAO_YOU_0/article/details/89576782