<script type=”text/javascript” language=”JavaScript”>
var i = 0;
function Questions(q) {
var ans=prompt(q,””);
return ans.toUpperCase();
}
q1=”What color is the sky?nA) Red ? Pink C) Black D) Blue”;
r1 = Questions(q1);
if(r1 == “D”) { alert(“Correct!”); i++} else { alert(“Wrong…”); };
q2=”What color is the grass?nA) Red ? Pink C) Green D) Blue”;
r2 = Questions(q2);
if(r2 == “C”) { alert(“Correct!”); i++} else { alert(“Wrong…”); };
alert(“You got ” + i + ” correct!”);
</script>
…..var ans = “…….why, when the user clicks on “cancel”, does the above whole script get cancelled, and is there a way i can get to continue ??”
if(ans || !ans)
{
document.write(“Thanks very much.”)
}