1. 程式人生 > >獲取位址列傳值

獲取位址列傳值

function getUrlParams (paramName) {
  var reg = new RegExp("[\?&]" + paramName + "=([^&]*)[&]?", "i");
  var paramVal = window.location.search.match(reg);
  return paramVal == null ? "" : decodeURIComponent(paramVal[1]);
}