ASP仿ECSHOP、京东数据筛选功能实现

DATE: 2016-11-10 / VIEWS: 977

凑合实现
  1. function submittemp(str,strval,pageurl)
  2.     Dim query, temp , tempA
  3.         temp=""
  4.         tempurl = LCase(Request.ServerVariables("QUERY_STRING"))
  5.         query = Split(tempurl,"&")
  6.                 for b = 0 to Ubound(query)
  7.                         if query(b)<>"" then
  8.                                 tempA=split(query(b),"=")
  9.                                 if tempA(0)=str then
  10.                                         query(b)=""
  11.                                 end if
  12.                         end if
  13.                 next
  14.         for b=0 to ubound(query)
  15.                 if query(b)<>"" then
  16.                         temp=temp&query(b)&"&"
  17.                 end if
  18.         next
  19.         if temp<>"" then temp=mid(temp,1,len(temp)-1)
  20.         if ubound(query)<0 then
  21.             if strval="" then
  22.                 submittemp = pageurl
  23.             else
  24.                 submittemp = pageurl&"?"&str&"="&strval
  25.             end if
  26.         else
  27.             if strval="" then
  28.                 if temp="" then
  29.                     submittemp = pageurl
  30.                 else
  31.                     submittemp = pageurl&"?"&temp
  32.                 end if
  33.             else
  34.                 if temp="" then
  35.                     submittemp = pageurl&"?"&str&"="&strval
  36.                 else
  37.                     submittemp = pageurl&"?"&temp&"&"&str&"="&strval
  38.                 end if
  39.             end if
  40.         end if
  41. end function


调用方法:<%=submittemp("筛选项","赋新值","当前页面")%>
例如:<%=submittemp("page","2","list.asp")%>