Make your own free website on
Accueil     |   home
Quizz creator
Quiz creator Cool Tool
I used to be a math teacher, and right now I'm flashing back to second-year algebra. That was the year I let the kids get their hands on a graphing calculator and figure out how to find the roots of quadratic equations simply by plugging in the equation. No quadratic formula required!
But all that time we spent singing "x equals / negative b / plus or minus radical" to the tune of "Jingle Bells" was not for naught, because I made sure they learned how to do it on their own before they got the tool to figure it out for them.
I'm using the same approach with JavaScript quizzes. In my last column, I showed you how to write a JavaScript quiz yourself. This time, I'm giving you a Cool Tool that will do it for you.
Quiz creator
The Quiz creator works on the same principle as many of my other Cool Tools. Be sure to read the instructions if you have any questions.
The Quiz creator builds a basic JavaScript quiz. It supplies the code to paste into your page based on your specifications, including the number of questions and responses. You can also choose whether to use radio buttons, pull-down menus, or text fields for the answers.
Of course, you may want a quiz with more bells and whistles--a variable number of choices for each question, a time limit on the questions, or more useful results tailored to the user's performance. Or you may be conducting a survey where, for example, the front end is JavaScript but the data is collected and stored on the server using CGI. Unfortunately, if that's what you're looking for you'll have to build it yourself.

Finally, I'd like to see what you're working on. If you've built a neat (bug-free, please!) JavaScript quiz for your site, send me the URL or post it in the Builder Buzz, BUILDER.COM's online conversation area. I'd like to see quizzes that are purely client-side JavaScript, and ones that work with CGI scripts or server-side JavaScript to store data and compile results. I'll showcase the most interesting quizzes in an upcoming column.

Note: If you tried to build your own quiz using the explanation in my last column and had trouble getting it to work using answers that were words instead of numbers, read on for a fix.

When the code in the quiz checks to see whether the user has chosen the correct answer, it does something like this:
if (form.elements[i].value == answers[i]) {
where answers[i] holds the correct answer for the corresponding question. If your answers are words (strings) rather than numbers, you must enclose them in quotes:
answers[0] = "dust off those rusty strings"
answers[1] = "just one more time"
answers[2] = "gonna make them"
answers[3] = "shine"
It's a good idea to do the same with answers that are numbers, although it's not necessary. Thanks to Clint Clark and Ed Romaine for asking the questions that brought this to my attention.
Quiz creator
Read more from Charity Kahn