Chat Room | Online main function: In the chat room, every 5 minutes, to display the dialogue page, send a question, all users can answer.
The correct person plus the corresponding score.
Concrete implementation: Add an implied frame to the chat room frame,
This frame is refreshed every 5 minutes.
The contents of an ASP page within an implied frame are as follows:
<%@ language=vbscript%>
<%Response.Expires=0%>
<%
Dim Conn,rs
Application.Lock
Application ("Canswername") =application ("Answername") ' Save the name of the user who answered the question correctly
Application ("answername") = ""
Application ("tanswername") = "' Clear the name of the user who answered the wrong question
Set Conn=server.createobject ("ADODB. Connection ")
Accessdb= the connection of "Db1.mdb" ' Item Bank
mydsn= "Driver={microsoft Access DRIVER (*.mdb)};"
MYDSN=MYDSN & "dbq=" &server.mappath (ACCESSDB)
Conn.Open MyDSN
Set Rs = Server.CreateObject ("ADODB.") Recordset ")
Rs.cursorlocation=3
Rs.Open "SELECT * from question", Conn
Randomize ' randomly get the ID of a question
R=rs.recordcount
Id=int ((r-1) *rnd) +1
Rs.close
Set rs=nothing
Set Rs = Server.CreateObject ("ADODB.") Recordset ")
Rs.Open "SELECT * from question where questionid=" &id,conn
Application ("Questionname") =rs ("Questionname") ' Topic
Application ("QuestionID") =rs ("QuestionID") the ID of the question
Application ("Questioncent") =rs ("Questioncent") the score of the question
Description of application ("Questionclass") =rs ("Questionnotes")
Rs.close
Set Rs = Nothing
Set Ra = Server.CreateObject ("ADODB.") Recordset ")
Ra.open "SELECT * from ANSWER where questionid=" &id,conn
Options for application ("Answera") =ra ("Answera")
Application ("Answerb") =ra ("Answerb")
Application ("Answerc") =ra ("Answerc")
Application ("Answerd") =ra ("Answerd")
Application ("Answertrue") =ra ("Answertrue") the correct answer to the question
Ra.close
Set ra=nothing
Conn.close
Set conn=nothing
Application ("Questiontime") =now ()
Application.UnLock
%>
<HTML>
<meta http-equiv= ' content-type ' content= ' text/html; charset=gb2312 ' >
<link rel= ' stylesheet ' href= '. /style.css ' type= ' text/css ' >
<meta http-equiv= "Refresh" content= "300;url=question.asp" >
<title><%=application ("V")%></title>
<script language= "JavaScript" >
Parent. ShowSays.document.write (":******<br> system Message"); Show conversation window to chat room write problem
Parent. ShowSays.document.write ("* * on the title is: <%=application" Canswername ")%><br>");
Parent. ShowSays.document.write ("Question:: <%=application (" Questionname ")%>");
Parent. ShowSays.document.write ("<%=application" ("Questioncent")%> score (within 1 minutes, answer input ' #答案 ') <%=time ()%><br> ") ;
Parent. ShowSays.document.write ("A::<%=application" ("Answera")%><br> ");
Parent. ShowSays.document.write ("B::<%=application" ("Answerb")%><br> ");
Parent. ShowSays.document.write ("C::<%=application" ("Answerc")%><br> ");
Parent. ShowSays.document.write ("D::<%=application" ("Answerd")%><br> ");
</script>
<body bgcolor= ' #FFFFFF ' >
</Body>
Handle the answer part slightly!!!