ASP提取ACCESS数据库里面的会员ID数组数据后,要求对应会员的复选框被选中,求解答
rs2是提取所有会员的信息,teacher变量是另外一个数据表已经选好会员ID的数据<%fori=1tors2.recordcount%><inputtype="chec...
rs2是提取所有会员的信息,teacher变量是另外一个数据表已经选好会员ID的数据
<% for i=1 to rs2.recordcount %>
<input type="checkbox" name="teacher" value="<%=rs2("U_ID")%>"
<%
dim es
es = split(teacher,",")
if IsArray(es) then
for j=lbound(es) to ubound(es)
if rs2("U_ID")=es(j) then response.write "checked='checked'" end if
next
end if %>/><%=rs2("U_Name")%>
<% rs2.movenext
next %>
比如,所有会员ID是1,2,3,4;teacher=1,2 ,用split分割函数,取得es(0)=1,es(1)=2.
上面的代码运行后,只能得到
要求value=1和2的复选框被选中(如图)。求解答!~~问题解决了分数可以加的 展开
<% for i=1 to rs2.recordcount %>
<input type="checkbox" name="teacher" value="<%=rs2("U_ID")%>"
<%
dim es
es = split(teacher,",")
if IsArray(es) then
for j=lbound(es) to ubound(es)
if rs2("U_ID")=es(j) then response.write "checked='checked'" end if
next
end if %>/><%=rs2("U_Name")%>
<% rs2.movenext
next %>
比如,所有会员ID是1,2,3,4;teacher=1,2 ,用split分割函数,取得es(0)=1,es(1)=2.
上面的代码运行后,只能得到
要求value=1和2的复选框被选中(如图)。求解答!~~问题解决了分数可以加的 展开
2个回答
展开全部
<% for i=1 to rs2.recordcount %>
<input type="checkbox" name="teacher" value="<%=rs2("U_ID")%>"
<%
dim es
es = split(teacher,",")
if IsArray(es) then
for j=0 to ubound(es)
if Cstr(rs2("U_ID"))=es(j) then
response.write "checked='checked'"
exit for
end if
next
end if%>/><%=rs2("U_Name")%>
<%rs2.movenext
next %>
<input type="checkbox" name="teacher" value="<%=rs2("U_ID")%>"
<%
dim es
es = split(teacher,",")
if IsArray(es) then
for j=0 to ubound(es)
if Cstr(rs2("U_ID"))=es(j) then
response.write "checked='checked'"
exit for
end if
next
end if%>/><%=rs2("U_Name")%>
<%rs2.movenext
next %>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
es = split(teacher,",")
for j=lbound(es) to ubound(es)
teacher = teacher & "|"&es(j)&"|"
next
%>
<% for i=1 to rs2.recordcount %>
<input type="checkbox" name="teacher" value="<%=rs2("U_ID")%>" <%if instr(teacher,"|"&rs2("U_ID")&"|")>0 then response.write "checked='checked'" end if%>/>
<%=rs2("U_Name")%>
<%
rs2.movenext
next
%>
es = split(teacher,",")
for j=lbound(es) to ubound(es)
teacher = teacher & "|"&es(j)&"|"
next
%>
<% for i=1 to rs2.recordcount %>
<input type="checkbox" name="teacher" value="<%=rs2("U_ID")%>" <%if instr(teacher,"|"&rs2("U_ID")&"|")>0 then response.write "checked='checked'" end if%>/>
<%=rs2("U_Name")%>
<%
rs2.movenext
next
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询