thaiall logomy background
coding : quiz. quizauto.asp.
my town
Source : Perl | PHP | ASP | JSP | HTML | HTML5 | JavaScript | Java | COBOL | C++ | MS Access | VBNet | VB | Python | โค้ดดี
File : quizauto.asp. ID : 2605
Skin : Default | Sons-of-obsidian | Sunburst | Highlighter | Full
<%
dim connect, rs, sql, scolor, i, qchoose, qprocess, chk
qchoose = request.form("subj") + request.querystring("subj") 
qprocess = request.form("process") + request.querystring("process") 
if len(qchoose) < 2 then qchoose = "math01"
if len(qprocess) < 2 then qprocess = "show"
set connect = server.createobject("ADODB.Connection")
connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &_
Server.MapPath("\perlphpasp\db\quiz.mdb"))
sql = "select * from " + qchoose
set rs = connect.execute(sql)
%>
<html><head><title>Automatic checking</title></head>
<body bgcolor="#ffffdd"><font face="microsoft sans serif" size=0><ul>
<%
if qprocess = "show" then 
  response.write(request.form("subj"))
  response.write("<form method=post action=quizauto.asp>")
  response.write("<input name=subj type=hidden value=" & qchoose &">")
  response.write("<input name=process type=hidden value=check>")
  i = 1
  if Not rs.eof then rs.MoveFirst
  do while Not rs.eof and i <= 10     
    response.write("<hr><b>"&i& "." &rs("question")&"</b> "&rs("qid")&_            
    "<br><input type=hidden name=gqid" & i & " value=" &rs("qid") &">"&_
    "<input type=hidden name=gans" & i & " value=" &rs("ans") &">"&_      
    "<input type=radio name=c"&i&" value=1>a. "&rs("choice1")&"<br>"&_
    "<input type=radio name=c"&i&" value=2>b. "&rs("choice2")&"<br>"&_      
    "<input type=radio name=c"&i&" value=3>c. "&rs("choice3")&"<br>"&_   
    "<input type=radio name=c"&i&" value=4>d. "&rs("choice4")&"<br>")   
    rs.MoveNext
    i = i + 1
  loop
  response.write( "<input type=submit name=submit value=SendAns>" )
  response.write( "<input type=reset name=reset value=Reset></form>" ) 
else
  i = 1
  if Not rs.eof then rs.MoveFirst
  do while Not rs.eof and i <= 10        
    g_qid = request.form("gqid" & i)
    g_ans = request.form("gans" & i)
    g_c = request.form("c" & i)
    response.write( "<hr>"& i & "." & rs("question") & rs("qid") &"<br>")               
    if g_qid = rs("qid") then     
      if g_ans = 1 then chk="/" else chk="X" end if
      response.write(chk & "a. "& rs("choice1") &"<br>") 
      if g_ans = 2 then chk="/" else chk="X" end if
      response.write(chk & "b. "& rs("choice2") &"<br>") 
      if g_ans = 3 then chk="/" else chk="X" end if
      response.write(chk & "c. "& rs("choice3") &"<br>") 
      if g_ans = 4 then chk="/" else chk="X" end if
      response.write(chk & "d. "& rs("choice4") &"<br>")      
      if g_ans = g_c then 
        response.write("Right.")
      else
        response.write("Wrong. Try again. [" & g_c & "]")
      end if
    end if
    rs.MoveNext
    i = i + 1
  loop
end if
connect.close
set rs = nothing
set connect = nothing
%>
</ul></body></html>
จำนวน : 67 บรรทัด
าษาเฮชทีเอ็มแอล (HTML = HyperText Markup Language) คือ ภาษาคอมพิวเตอร์ที่ออกแบบมาเพื่อใช้ในการสร้างเว็บเพจที่เรียกดูผ่านทางเว็บเบราว์เซอร์ (Web Browser) เริ่มพัฒนาโดย ทิม เบอร์เนอรส์ ลี (Tim Berners Lee) ในปัจจุบัน HTML ล่าสุดคือ รุ่น 5 เป็นมาตรฐานหนึ่งของ ISO ซึ่งจัดการโดย World Wide Web Consortium (W3C) ในปัจจุบัน ทาง W3C ผลักดัน รูปแบบของ HTML แบบใหม่ ที่เรียกว่า XHTML รุ่นแรกคือ 1.0 (ม.ค.2543) ซึ่งมีโครงสร้างเป็นแบบ XML (eXtensible Markup Language)
าษาพีเอชพี (PHP Language) คือ ภาษาคอมพิวเตอร์ประเภทโอเพนท์ซอร์ท (Open Source Computer Language) สำหรับพัฒนาเว็บเพจแบบไดนามิก เมื่อเครื่องบริการได้รับคำร้องจากผู้ใช้ก็จะส่งให้กับ ตัวแปลภาษา ทำหน้าที่ประมวลผลและส่งข้อมูลกลับไปยังเครื่องของผู้ใช้ที่ร้องขอ ในรูปเอชทีเอ็มแอล ภาพ หรือแฟ้มดิจิทอลอื่นใด ลักษณะของภาษามีรากฐานคำสั่งมาจากภาษาซี เป็นภาษาที่สามารถพัฒนาให้ใช้งานแบบโต้ตอบกับผู้ใช้ได้
าษาไพทอน (Python Language) คือ ภาษาคอมพิวเตอร์ประเภทโอเพนท์ซอร์ท (Open Source Computer Language) สำหรับพัฒนาแอพพลิเคชั่นโดยไม่ยึดติดกับแพลตฟอร์ม (Platform) และใช้ในงานได้หลายประเภท ทั้งใช้ในการประมวลผลผ่านคอมมานด์ไลน์ หรือเป็นเว็บเพจแบบไดนามิก เมื่อเครื่องบริการได้รับคำร้องจากผู้ใช้ก็จะส่งให้โค้ดให้กับตัวแปลภาษา เพื่อทำหน้าที่ประมวลผลและส่งข้อมูลกลับไปยังเครื่องของผู้ใช้ที่ร้องขอ ในรูปข้อความ เอชทีเอ็มแอล ภาพ หรือแฟ้มดิจิทอลอื่นใด ลักษณะของภาษามีรากฐานคำสั่งมาจากภาษาซี เป็นภาษาที่สามารถพัฒนาให้ใช้งานแบบโต้ตอบกับผู้ใช้ได้ จุดที่แตกต่างกับภาษาอื่น คือ การรวบรวมจุดเด่นของแต่ละภาษามารวมเข้าด้วยกัน
ตัวอย่าง Hello World
ปรับปรุงโปรแกรม source.pl : 2565-07-24
rspsocial
Thaiall.com