<!DOCTYPE html>
<html>
<body>
<p>Quiz</p>
<script type = "text/javascript"">
var score = 0;
var value = prompt("How many seconds in one hour: ", "");
if (value == "60")
{
alert("Yes correct!");
score += 1; //add 1 to score
}
else
{
alert("Sorry the answer is incorrect, the answer is 60");
}
var value = prompt("How many days in one week: ", "");
if (value == "7")
{
alert("Yes correct!");
score += 1;
}
else
{
alert("Sorry the answer is incorrect, the answer is 7");
}
var value = prompt("How many days in one year: ", "");
if (value == "365")
{
alert("Yes correct!");
score += 1;
}
else
{
alert("Sorry the answer is incorrect, the answer is 365");
}
document.write("Your score is (score) out of 3");
</script>
</body>
</html>
This post has been edited by Dormilich: 26 November 2012 - 11:45 PM
Reason for edit:: please use [code] [/code] tags when posting code

New Topic/Question
Reply


MultiQuote




|