cf冰域瞬移2017:怎么修改这个ASP投票系统。复选的时候锁定在10项目?

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 21:03:31
<!-- #include file="conn.asp"-->
<%
on error resume next
dim id,rs,v,chk,vv,vvv
id=request.form("id")
v=request.form("v")
chk=request.form("chk")
idd=request.form("idd")
if session(idd)=idd then
end if
if id<>"" and v<>"" and idd<>"" then
select case chk
case "1" '单选
conn.execute("update V_vote set vcount=vcount+1 where id=cint('"&v&"')")
case "2" '多选
vvv=replace(v," ","")
vv=split(vvv,",")
for i= 0 to ubound(vv)
conn.execute("update V_vote set vcount=vcount+1 where id=cint('"&vv(i)&"')")
next
end select
session(idd)=idd
response.write "<script>alert('投票成功');history.back();</script>"
response.end
else
response.write "<script>alert('请仔细阅读投票注意事项);history.back();</script>"
response.end
end if
%>

就是当选上复选的时候。必须<>10 少于或者多余10项的时候都有错误提示“请仔细阅读投票注意事项”!谢谢。
杰克船长: 你好。可以麻烦你把这小段代码写出来吗?

你可以用一个变量和一个FOR语句来对选择的项目数进行记数,当满足条件时就可以执行你的功能了