<SCRIPT>

function testQuestion(question, chances) {
     var answer = eval(question);
     var output = "What is " + question + "?";

     var correct = '<IMG SRC="correct.gif">';
     var incorrec = '<IMG SRC="incorrec.gif">';

     var response = prompt(output, "0");

     if (chances > 1) {
          return (response == answer) ? correct : testQuestion(question, chances - 1);
     }
     else {
          return (response == answer) ? correct : incorrec;
     }
}

</SCRIPT>

<SCRIPT>

var result = testQuestion("10 + 10", 3);

document.write(result);

</SCRIPT>