求助, 如何做成 只可以选择最多选择5项投票!
<%Dim Action,IDBBS.CheckMake
If not BBS.FoundUser Then BBS.GoToErr(10)
ID=BBS.CheckNum(request.querystring("Id"))
Action=Lcase(Request.querystring("Action"))
If len(Action)>13 then BBS.GoToErr(1)
If Action="vote" Then
SubmitVote()
Else
SubmitBuyer()
End If
Set BBS =Nothing
Response.redirect(Request.ServerVariables("HTTP_REFERER"))
Sub SubmitVote()
Dim Temp,Rs,i,VoteType,Vote,VoteNum,TempVote,MyOpt,OutTime,AllVoteNum
IF ID=0 Then BBS.GoToErr(1)
VoteType=BBS.checknum(request.querystring("type"))
Set Rs=BBS.execute("select Vote,VoteNum,VoteType,OutTime From[TopicVote] where TopicID="&ID&"")
IF Not Rs.Eof Then
Vote=split(Rs("vote"),"|")
VoteNum=split(Rs("voteNum"),"|")
OutTime=Rs("OutTime")
IF VoteType<>Int(Rs("VoteType")) Then BBS.GoToErr(1)
TempVote=Vote
if VoteType=1 then
Temp=BBS.CheckNum(Request.form("opt"))
MyOpt=Temp
For i=1 to ubound(Vote)
If i=Temp then VoteNum(i)=VoteNum(i)+1
AllVoteNum=AllVoteNum&"|"&VoteNum(i)
Next
ElseIf VoteType=2 Then
Temp=0
TempVote=Vote
For i=1 to ubound(Vote)
TempVote(i)=BBS.Checknum(Request.form("opt"&i&""))
Temp=TempVote(i)+Temp
IF TempVote(i)=0 Then TempVote(i)=VoteNum(i)
IF TempVote(i)=i Then
TempVote(i)=Votenum(i)+1
MyOpt=MyOpt&","&i
End if
AllVoteNum=AllVoteNum&"|"&TempVote(i)
Next
Else
BBS.GoToErr(1)
End if
If temp=0 Then BBS.alert"请选择投票!","back"
IF Temp<>0 And BBS.execute("select User From [TopicVoteUser] where User='"&BBS.MyName&"' and TopicID="&ID&"").Eof Then
If DateDiff("s",BBS.NowBbsTime,OutTime)>0 then
BBS.execute("update [TopicVote] Set VoteNum='"&AllvoteNum&"' where TopicID="&ID&"")
BBS.execute("update [Topic] Set LastTime='"&BBS.NowBbsTime&"' where TopicID="&ID&"")
BBS.execute("update [bbs"&BBS.TB&"] Set LastTime='"&BBS.NowBbsTime&"' where TopicID="&ID&"")
BBS.execute("Insert into [TopicVoteUser](TopicID,[User],VoteNum)VALUES("&ID&",'"&BBS.MyName&"','"&MyOpt&"')")
End If
End If
End if
Rs.Close
Set Rs=nothing
End Sub