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

DATE: 2016-11-10 / VIEWS: 898

凑合实现
function submittemp(str,strval,pageurl)
    Dim query, temp , tempA
        temp=""
        tempurl = LCase(Request.ServerVariables("QUERY_STRING"))
        query = Split(tempurl,"&")
                for b = 0 to Ubound(query)
                        if query(b)<>"" then
                                tempA=split(query(b),"=")
                                if tempA(0)=str then
                                        query(b)=""
                                end if
                        end if
                next
        for b=0 to ubound(query)
                if query(b)<>"" then
                        temp=temp&query(b)&"&"
                end if
        next
        if temp<>"" then temp=mid(temp,1,len(temp)-1)
        if ubound(query)<0 then
            if strval="" then
                submittemp = pageurl
            else
                submittemp = pageurl&"?"&str&"="&strval
            end if
        else
            if strval="" then
                if temp="" then
                    submittemp = pageurl
                else
                    submittemp = pageurl&"?"&temp
                end if
            else
                if temp="" then
                    submittemp = pageurl&"?"&str&"="&strval
                else
                    submittemp = pageurl&"?"&temp&"&"&str&"="&strval
                end if
            end if
        end if
end function


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