我创建了一个测验,其中包含20个MCQ问题(在一页中)。第一件事是用户必须选择他/她希望尝试的问题的数量。这是我的两个单选按钮:
<p>Choose the number of question you want to attempt at a time</p>
3 Question<input type="radio" name="radiobutton" onClick="load('expert1.html')"/><br>
OR<br>
5 Question<input type="radio" name="radiobutton" onClick="load('expert1.html')" />
当用户选择第一个单选按钮时,只有3个问题必须在新页面上显示,并且在用户回答3个问题后,它会转到另一个3个问题集,第二个单选按钮则相同。
我的问题是,当用户选择单选按钮时,无法显示3个问题或5个问题。
我的mcq问题:
var questions = new Array();
var choices = new Array();
var answers = new Array();
var response = new Array();
questions[0] = "1) RS-449/442-A/423-A is";
choices[0] = new Array();
choices[0][0] = "a set of physical layer standards developed by EIA and intended to replace RS-232-C.";
choices[0][1] = "a check bit appended to an array of binary digits to make the sum of the all the binary digits";
choices[0][2] = "a code in which each expression conforms to specific rules of construction, so that if certain errors occur in an expression the resulting expression will not conform to the rules of construction and thus the presence of the errors is detected";
choices[0][3] = "the ratio of the number of data units in error to the total number of data units";
answers[0] = choices[0][0];
questions[1] = "2) CSMA (Carrier Sense Multiple Access) is";
choices[1] = new Array();
choices[1][0] = "a method of determining which device has access to the transmission medium at any time";
choices[1][1] = "a method access control technique for multiple-access transmission media.";
choices[1][2] = "network access standard for connecting stations to a circuit-switched network";
choices[1][3] = "a very common bit-oriented data link protocol issued by ISO.";
answers[1] = choices[1][1];
questions[2] = "3) ARP (Address Resolution Protocol) is";
choices[2] = new Array();
choices[2][0] = "a TCP/IP protocol used to dynamically bind a high level IP Address to a low-level physical hardware address";
choices[2][1] = "a TCP/IP high level protocol for transferring files from one machine to another";
choices[2][2] = "a protocol used to monitor computers";
choices[2][3] = "a protocol that handles error and control messages";
answers[2] = choices[2][0];
questions[3] = "4) When referring to instruction words, a mnemonic is:";
choices[3] = new Array();
choices[3][0] = "a short abbreviation for the operand address";
choices[3][1] = "a short abbreviation for the operation to be performed";
choices[3][2] = "a short abbreviation for the data word stored at the operand address";
choices[3][3] = "shorthand for machine language";
answers[3] = choices[3][1];
questions[4] = "5) Which of the following statement is wrong ?";
choices[4] = new Array();
choices[4][0] = "mes = 123.56";
choices[4][1] = "con = 'T' * 'A'";
choices[4][2] = "this = 'T' * 20";
choices[4][3] = "3 + a = b";
answers[4] = choices[4][3];
questions[5] = "6) What is the term used for describing the judgmental or commonsense part of problem solving?";
choices[5] = new Array();
choices[5][0] = "Heuristic.";
choices[5][1] = "Critical";
choices[5][2] = "Value based";
choices[5][3] = "Analytical";
answers[5] = choices[5][0];
questions[6] = "7) What stage of the manufacturing process has been described as the mapping of function onto form?";
choices[6] = new Array();
choices[6][0] = "Design";
choices[6][1] = "Distribution";
choices[6][2] = "project management";
choices[6][3] = "field service";
answers[6] = choices[6][0];
questions[7] = "8) To invoke the LISP system, you must enter";
choices[7] = new Array();
choices[7][0] = "AI";
choices[7][1] = "LISP";
choices[7][2] = "CL (Common Lisp)";
choices[7][3] = "both b and c";
answers[7] = choices[7][3];
questions[8] = "9) Ambiguity may be caused by:";
choices[8] = new Array();
choices[8][0] = "syntactic ambiguity";
choices[8][1] = "multiple word meanings";
choices[8][2] = "unclear antecedents";
choices[8][3] = "All of the above";
answers[8] = choices[8][3];
questions[9] = "10) The functional difference between SR flip-flop and JK flip-flop is that";
choices[9] = new Array();
choices[9][0] = "JK flip-flop is faster than SR flip-flop";
choices[9][1] = "JK flip-flop has a feed back path";
choices[9][2] = "JK flip-flop accepts both inputs 1";
choices[9][3] = "JK flip-flop does not require external clock";
answers[9] = choices[4][0];
questions[10] = "11) ASCII and EBCDIC differ in";
choices[10] = new Array();
choices[10][0] = "their efficiency in storing data";
choices[10][1] = "the random and sequential access method";
choices[10][2] = "the number of bytes used to store characters";
choices[10][3] = " their collecting sequences";
answers[10] = choices[10][3];
questions[11] = "12) The time required for a pulse to decrease from 90 to 10 percent of its maximum value is known as";
choices[11] = new Array();
choices[11][0] = "rise time";
choices[11][1] = "decay time";
choices[11][2] = "binary level transition period";
choices[11][3] = "propagation delay";
answers[11] = choices[11][1];
questions[12] = "13) A combinational logic circuit which is used when it is desired to send data from two or more source through a single transmission line is known as";
choices[12] = new Array();
choices[12][0] = "encoder";
choices[12][1] = "decoder";
choices[12][2] = "multiplexer";
choices[12][3] = "demultiplexer";
answers[12] = choices[12][2];
questions[13] = "14) The m-bit parallel adder consists of:";
choices[13] = new Array();
choices[13][0] = "(m+1) full adders";
choices[13][1] = "m/2 full adders";
choices[13][2] = "m-1 full adders";
choices[13][3] = "m full adders";
answers[13] = choices[13][3];
questions[14] = "15) Why are digital circuits easier to design than analog circuits?";
choices[14] = new Array();
choices[14][0] = "they do not control electricity precisely over a wide range";
choices[14][1] = "they are made in the form of ICs";
choices[14][2] = "all elements of digital circuit are from the same family";
choices[14][3] = "they are smaller in size";
answers[14] = choices[14][0];
questions[15] = "16) The _____ is ultraviolet-light-erasable and electrically programmable. This allows the user to erase and store until programs and data are perfected.";
choices[15] = new Array();
choices[15][0] = "EPROM";
choices[15][1] = "ROM";
choices[15][2] = "PROM";
choices[15][3] = " RAM";
answers[15] = choices[15][0];
questions[16] = "17) The logic 1 in positive logic system is represented by:";
choices[16] = new Array();
choices[16][0] = "zero voltage";
choices[16][1] = " lower voltage level";
choices[16][2] = "higher voltage level";
choices[16][3] = "negative voltage";
answers[16] = choices[16][2];
questions[17] = "18) Which of the following TTL subfamily is the fastest";
choices[17] = new Array();
choices[17][0] = "standard TTL";
choices[17][1] = "high-speed TTL";
choices[17][2] = "schottky TTL";
choices[17][3] = "low-speed TTL";
answers[17] = choices[17][2];
questions[18] = "19) Cyclic codes are used in";
choices[18] = new Array();
choices[18][0] = " data transfer";
choices[18][1] = "continuously varying signal representation";
choices[18][2] = "arithmetic and logical computation";
choices[18][3] = "All of the above";
answers[18] = choices[18][1];
questions[19] = "20) How many full and half-adders are required to add 16-bit numbers?";
choices[19] = new Array();
choices[19][0] = "8 half-adders, 8 full-adders";
choices[19][1] = "1 half-adders, 15 full-adders";
choices[19][2] = "16 half-adders, no full-adders";
choices[19][3] = "4 half-adders, 12 full-adders";
answers[19] = choices[19][1];
答案 0 :(得分:0)
第一步:使用$ _GET参数
<p>Choose the number of question you want to attempt at a time</p>
3 Question<input type="radio" name="radiobutton" onClick="load('expert1.html?number=3')"/><br>
OR<br>
5 Question<input type="radio" name="radiobutton" onClick="load('expert1.html?number=5')" />
第二步:阅读$ _GET参数并相应地显示问题
$numberOfQuestions = $_GET['number'];
// ...