»
Tiếng AnhTiếng PhápTiếng Việt

In - Tạo câu hỏi trắc nghiệm - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Ứng dụng » Trắc nghiệm » Tạo câu hỏi trắc nghiệm
URL: http://www.javascriptbank.com/javascript-quiz-maker.html

Tạo câu hỏi trắc nghiệm © JavaScriptBank.comTrình tạo câu hỏi trắc nghiệm trên trang web, cho phép ta tạo ra nhiều loại câu hỏi khác nhau như câu hỏi chọn lựa, đúng/sai...

Phiên bản đầy đủ: jsB@nk » Ứng dụng » Trắc nghiệm » Tạo câu hỏi trắc nghiệm
URL: http://www.javascriptbank.com/javascript-quiz-maker.html



JavaScript
<SCRIPT language=javascript><!--function countTxt(index,limit) { txtCount = eval("document.all.char_count" + index);n=eval("document.all.txtarea" + index + ".value.length");txtCount.innerText = n;if (n>limit)  alert("You have exceeded the character limit.");}function DeleteWarning(what_id){if(confirm("Are you sure you want to delete question number: " + what_id)){return true;} else {return false;}}function validate(){var err;FRM = document.frmQ;addA = FRM.choice1;addB = FRM.choice2;addC = FRM.choice3;addD = FRM.choice4;addE = FRM.choice5;addAns = FRM.correct_answer;if (frmQ.question.value==""){frmQ.question_E.value = "*Error: Please enter question..."alert("*Please Input Question*")err=1;return false;} else {/*there is a question*/frmQ.question_E.value = ""/*check if there are choices*/switch(frmQ.the_question_type.value){case "5": if (addA.value!="" && addB.value!="" && addC.value!="" && addD.value!="" && addE.value!=""){if(addAns.value=="SELECTING"){alert("don't fotget the answer...")err=1;return false;} else {//alert("OK MULTIPLE CHOICES")}} else {alert("Fill all textboxes")err=1;return false;}break;case "2":if (addA.value!="" && addB.value!="" && addC.value=="" && addD.value=="" && addE.value==""){if(addAns.value=="A") {//alert("OK TRUE / FALSE")err=0;} else if (addAns.value=="B") {//alert("OK TRUE / FALSE")err=0;} else {alert("don't fotget the answer... \nchoose A or B for this type of question")err=1;return false;}} else {alert("Fill the first two textboxes only")err=1;return false;}break;case "1":if (addA.value!="" && addB.value=="" && addC.value=="" && addD.value=="" && addE.value==""){if(addAns.value=="SELECTING"){alert("don't fotget the answer...")err=1;return false;} else {//alert("OK PNG")err=0;}} else {alert("Fill the first textbox only")err=1;return false;} break;case "0":alert("*Please Select Question-type*")err=1;return false;break;}}if (err==0) {return true;}}//--></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=countTxt(1,1000);><H3>PREMIUM TESTS MAIN CONTENT QUESTIONS</H3><FORM name=frmQ action=form_validation_rmk.html method=post><TABLE width=900 ?>  <TBODY>  <TR>    <TD class=container>QUESTION: <BR>(memo 1000)</TD>    <TD><TEXTAREA id=txtarea1 onkeyup="return countTxt(1,1000);" name=question rows=3 wrap=virtual cols=60></TEXTAREA>       <INPUT       style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; FONT-SIZE: 11px; BORDER-LEFT: medium none; WIDTH: 200px; COLOR: red; BORDER-BOTTOM: medium none; BACKGROUND-COLOR: #cee6fe"       name=question_E size="20"> <BR><SPAN class=sidecomments>Character count:&nbsp;<SPAN       id=char_count1></SPAN> </SPAN></TD></TR>  <TR>    <TD style="FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: blue">Type of Question:</TD>    <TD><SELECT name=the_question_type> <OPTION value=0 selected>Select type of question</OPTION> <OPTION value=5>Multiple Choice</OPTION> <OPTION         value=2>True / False</OPTION> <OPTION value=1>Picture (PNG)</OPTION></SELECT> </TD></TR>  <TR>    <TD class=container>(50) CHOICE 1 or A:</TD>    <TD><SPAN class=sidecomments><INPUT class=text maxLength=50 size=56       name=choice1> </SPAN></TD></TR>  <TR>    <TD class=container>(50) CHOICE 2 or B:</TD>    <TD><SPAN class=sidecomments><INPUT class=text maxLength=50 size=56       name=choice2> </SPAN></TD></TR>  <TR>    <TD class=container>(50) CHOICE 3 or C:</TD>    <TD><SPAN class=sidecomments><INPUT class=text maxLength=50 size=56       name=choice3> </SPAN></TD></TR>  <TR>    <TD class=container>(50) CHOICE 4 or D:</TD>    <TD><SPAN class=sidecomments><INPUT class=text maxLength=50 size=56       name=choice4> </SPAN></TD></TR>  <TR>    <TD class=container>(50) CHOICE 5 or E:</TD>    <TD><SPAN class=sidecomments><INPUT class=text maxLength=50 size=56       name=choice5> </SPAN></TD></TR>  <TR>    <TD class=gender>CORRECT ANSWER</TD>    <TD class=gender><SPAN class=sidecomments><SELECT name=correct_answer>         <OPTION value=SELECTING selected>Select correct answer</OPTION> <OPTION         value=A>A</OPTION> <OPTION value=B>B</OPTION> <OPTION value=C>C</OPTION>         <OPTION value=D>D</OPTION> <OPTION value=E>E</OPTION></SELECT>   </SPAN></TD></TR><!-- here comes the buttons -->  <TR>    <TD width=150 height=32></TD>    <TD height=32><INPUT class=button onclick="return validate()" type=submit value="            SAVE CHANGES             " name=action> <INPUT class=button type=submit value="      RESET     " name=action>   </TD></TR></TBODY></TABLE></FORM><BR>This form will not submit. This directory does not allow it.</BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->