展开全部
你自己看着改下吧,这是我网站上的一个答题库里的程序,能看明白吧?
<%
Sub ShowRndData(Num)
Dim rs,I,R,RsBound
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.open "Select * from dati_ku where passed=1",conn,1,1
RsBound=rs.recordCount
If RsBound<Num Then Num=RsBound
For I = 0 To Num-1
R=GR(RsBound)
Rs.Move(R)
Response.Write "<b>"&rs("SType")&"</b>:"&rs("SQuestion")&"("&rs("AddExp")&"分题)<br><br> <b>填写答案</b>:<input name='SAnswer' type='text' id='SAnswer' maxlength='20'> <input name='Action' type='hidden' id='Action' value='Save'><input name='cidianID' type='hidden' id='cidianID' value='"&rs("cidianid")&"'><input type='submit' name='Submit' value='确定'><br><br> <b>上传用户</b>:"&rs("shangchuan")&" (欢迎朋友们为本站提供题库)<br><br> <a href='"&strFileName&"'><img src='pic/arrow04.gif' border='0'>>>>>>>>>>> 这道题有点难,我要答下一道题。</a> "
Rs.Move(-R)
Next
rs.close
Set rs=Nothing
End Sub
Function GR(Bound)
Randomize
Dim R:R=Int(Bound*Rnd)
If Instr(Arr,"["&R&"]") Then:R=GR(Bound):End If
Arr=Arr&"["&R&"]"
GR=R
End Function
Dim Arr
'下面这句是调用
Call ShowRndData(1)
%>
<%
Sub ShowRndData(Num)
Dim rs,I,R,RsBound
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.open "Select * from dati_ku where passed=1",conn,1,1
RsBound=rs.recordCount
If RsBound<Num Then Num=RsBound
For I = 0 To Num-1
R=GR(RsBound)
Rs.Move(R)
Response.Write "<b>"&rs("SType")&"</b>:"&rs("SQuestion")&"("&rs("AddExp")&"分题)<br><br> <b>填写答案</b>:<input name='SAnswer' type='text' id='SAnswer' maxlength='20'> <input name='Action' type='hidden' id='Action' value='Save'><input name='cidianID' type='hidden' id='cidianID' value='"&rs("cidianid")&"'><input type='submit' name='Submit' value='确定'><br><br> <b>上传用户</b>:"&rs("shangchuan")&" (欢迎朋友们为本站提供题库)<br><br> <a href='"&strFileName&"'><img src='pic/arrow04.gif' border='0'>>>>>>>>>>> 这道题有点难,我要答下一道题。</a> "
Rs.Move(-R)
Next
rs.close
Set rs=Nothing
End Sub
Function GR(Bound)
Randomize
Dim R:R=Int(Bound*Rnd)
If Instr(Arr,"["&R&"]") Then:R=GR(Bound):End If
Arr=Arr&"["&R&"]"
GR=R
End Function
Dim Arr
'下面这句是调用
Call ShowRndData(1)
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询