js判断Url参数并设置标题方法之一

<script type=text/javascript>
  window.onload = function()
  {
   var queryString = window.location.href.substring(location.href.indexOf("?") +1);
   var x = queryString.split("&");
   var name,value,pos;
   pos = x[0].indexOf("=")
   if (pos != -1)
   {
    value = x[0].substring(pos+1);
    setTitle(value);
   }
   
  }
  function setTitle(x)
  {
   if (x == "select")
   {
    window.document.title = "需追溯物料查询"
   }
  }
  </script>

你可能感兴趣的:(url)