//1、fieldName参数名称,比如http://Business_center/Function_page/ShopMall/WebMenu.aspx?id=45

//id 传进去就能得到45

 function GetUrl(fieldName)
    { 
      var urlString = document.location.search;
      if(urlString != null)
      {
           var typeQu = fieldName+"=";
           var urlEnd = urlString.indexOf(typeQu);
           if(urlEnd != -1)
           {
                var paramsUrl = urlString.substring(urlEnd+typeQu.length);
                var isEnd =  paramsUrl.indexOf('&');
                if(isEnd != -1)
                {
                     return paramsUrl.substring(0, isEnd);
                }
                else
                {
                    return paramsUrl;
                }
           }
           else
           {
                return null;
           }
      }
     else
     {
        return null;
     }
    }

posted on 2009-05-11 15:00  自己  阅读(792)  评论(0编辑  收藏  举报