Little experience in online test system

xiaoxiao2021-03-06  66

Note: Use the ASP.NET SQLSERVER2000, the topic is only for the choice

I. Database design

1. The topic has a table

Fields include: Number ID (Identification Field), Topic Content, Topic Answer

2. Options There is a table

Fields include: Number (Identification Field), Topic ID, Display Order

II. Page design

If you log in, you don't say anything, you will talk about it.

1. If you randomly, you can use the order by newid () when you check the topic in the database.

Such as: select * from tablename Order by newid ()

After reading the topic, select the option in the topic of the topic to go to the option table, and then bound. At the same time, the answer needs to be read and bind to the page.

If the option is selected, you can bind a RadiobuttonList, and check the checkboxlist.

After the bind is good, you will generate a session ["time"] for saving time datetime.now ().

2. If the topic is fixed and each answer is the same, the topics and options are best placed in the page, or when reading it from the database (such as: Application), This increases in efficiency, reducing the pressure of the server.

3. Record the submission time while submitting and subtracting the SESSION ["Time"] generated in the entry page to get the answer time. The submitted answer is compared with the standard answer saved by the page, calculates the correct rate of the answer and the correct number of correct questions, and saves the library with the answer time.

When you submit, you need a verification of some clients. Here is a verified JavaScript code.

Function checkItem ()

{

Alchk = 0; // Used to save the number of questions

For (k = 0; k <44; k ) // 44 indicates 44 questions

{

CHKC = 0; // There are several elections in each question. Here I use Checkbox, if you use RadiobottonList, you can only have a check.

For (j = 0; j <4; j ) // 4 indicates that there are 4 selection items each question

{

Strid = 'dlquestion__ctl' k '_ dlselection__ctl' J '_ ckselection'; // Get the ID in the page

IF ((Document.GetElementByid (Strid)). Checked) // If you choose

{

CHKC ;

}

}

IF (CHKC> 1) / / indicates more than one option

{

H = k 1;

Alert ('first' h 'question answers more than one!');

Return False;

}

IF (CHKC <1)

{

}

Else

{

Alchk ;

}

}

IF (Alchk <44) // Alchk <44 indicates that there is no answer

{

// Alert ('not finished');

Return Confirm ('You have the topic is not completed, is it committed?');

}

RETURN CONFIRM ('OK Submit?');

}

4. You also need to use some JavaScript scripts, as follows