JoinChar 向地址中加入 ? 或 & 用于实现传参

时间:2022-09-18 22:22:46
  1. '**************************************************  
  2. '函数名:JoinChar  
  3. '作  用:向地址中加入 ? 或 &  
  4. '参  数:strUrl  ----网址  
  5. '返回值:加了 ? 或 & 的网址  
  6. '**************************************************  
  7. function JoinChar(strUrl)  
  8.     if strUrl="" then  
  9.         JoinChar=""  
  10.         exit function  
  11.     end if  
  12.     if InStr(strUrl,"?")<len(strUrl) then   
  13.         if InStr(strUrl,"?")>1 then  
  14.             if InStr(strUrl,"&")<len(strUrl) then   
  15.                 JoinChar=strUrl & "&"  
  16.             Else  
  17.                 JoinChar=strUrl  
  18.             end if  
  19.         Else  
  20.             JoinChar=strUrl & "?"  
  21.         end if  
  22.     Else  
  23.         JoinChar=strUrl  
  24.     end if  
  25. end function