在线求助……

whw_614 2006-01-02 02:26:46
我在做一个考试系统,要求随机从试题库里抽取一些试题。
下面这个就是随机函数:我看不懂,请高手帮我解释一下,先谢谢了!
response.write"<form name='testpaper' action='judge.asp?canshu="&canshu&"' method='post'>"

x=1
if session("dan")<>"" then
sql="select * from 单选题目表 where 难度='"&nandu&"'"
set basedan=conn.execute(sql)
a=1
danxtl=0
danxfs=0
basedan.movefirst
do while not basedan.eof
danxtl=danxtl+1
danxfs=danxfs+basedan("试题分数")
dan(a)=basedan("试题ID")
a=a+1
basedan.movenext
loop

randomize
for i=1 to 2*danxtl
j=fix(rnd*danxtl)
k=fix(rnd*danxtl)
temp=dan(j)
dan(j)=dan(k)
dan(k)=temp
next

for i=1 to cdanxtl
for j=i+1 to cdanxtl
if dan(i)=dan(j) then

end if
next
next

response.write"<font size='4' color='red' face=''>"
response.write"<p id='单项选择题'>"&item(x)&"、单项选择题</font></p>"
for i=1 to cdanxtl
sql="select * from 单选题目表 where 难度='"&nandu&"' and 试题ID="&dan(i)&""
set basedan=conn.execute(sql)
danst(i)=basedan("试题")
danfs(i)=basedan("试题分数")
danans(i)=basedan("试题答案")
danid(i)=basedan("试题ID")
dantx(i)="单选"
if danst(i)<>"" then
response.write"<font size='2'>"&i&"."&danst(i)&"("&danfs(i)&"分)</font><br>"
response.write"<input type='radio' name='dan("&i&")' value='A'>A"
response.write"<font size='2' color='#C0C0C0'>____</font size='3'>"
response.write"<input type='radio' name='dan("&i&")' value='B'>B"
response.write"<font size='2' color='#C0C0C0'>____</font size='3'>"
response.write"<input type='radio' name='dan("&i&")' value='C'>C"
response.write"<font size='2' color='#C0C0C0'>____</font size='3'>"
response.write"<input type='radio' name='dan("&i&")' value='D'>D<br>"
response.write"<hr>"
else
end if
next
end if
x=x+1
...全文
66 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧