A script for Trivia created with JavaScript. The quizzes (questions and answers) are stored in external files, in XML or JSON format.
The Trivia Game has two levels:
• Level 1 - displays a list of answers to each quiz, and the user must click on the correct answer.
• Level 2 - is a little more difficult. The last letter from the possible answers is deleted. It is displayed a text box in which the user can write the answer.
It has two modes:
• Consecutive - the quiestions start from the quiz with index number added into a text field, and are displayed in their order till the last quiz.
• Random - the quizzes are choosed randomly, till the last quiz, without repeat.
Also, the user can choose to play the trivia with a Countdown Timer (15 seconds to answer till the script adds automatically the correct answer).
You can easily add quizzes and multiple categories in this Trivia script, the quizzes of each category are stored in its external file (more informations are in 'readme.html' file in the archive with this script).
<ul> <li>http://coursesweb.net/html/</li> <li>http://coursesweb.net/css/</li> </ul>
.some_class { display: list-item; }
var obj = { "courses": ["php", "javascript", "ajax"] }; var jsonstr = JSON.stringify(obj); alert(jsonstr); // {"courses":["php","javascript","ajax"]}
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>'; $dochtml = new DOMDocument(); $dochtml->loadHTML($strhtml); $elm = $dochtml->getElementById("dv1"); echo $elm->nodeValue; // CoursesWeb.net