WebAssignment-3 (2) - Word Rianna N Spann sert Design Layout References Mailings
ID: 3599471 • Letter: W
Question
WebAssignment-3 (2) - Word Rianna N Spann sert Design Layout References Mailings Review View Format Tell me File Home Calibri (Body) Paste Styles Editing Clipboard Font Paragraph Styles Part I: Math Quiz (50 points Create a website that display an adding quiz (use random numbers between 0 and 100), and a timer (see image-1). If the given answer is checked when OK button is clicked. Depending on the answer, wrong orAdding Quiz right, a suitable message should pop-up and the timer should wait until the user click okay button (see images 2 & 3). If the answer is correct a new quiz should be displayed, and the timer should be initialized to 0 (see image 4). If the answer is wrong, the original quiz should be displayed again, the answer box should be reset, and the timer should continue from the previous value image-1 The page say This page Adding Quiz 40 secod image-4 image-2 image-3 Page 1 of4 810 words + 100%Explanation / Answer
Here is the code i just created the basic one that is just like in the images , you can edit it and can give any title and footer or give some template , ie disign is upto you
Here is the code
<html>
<title>
Adding Quiz
</title>
<head>
</head>
<body>
<h1>Adding Quiz</h1><br/>
<?php
$n1=mt_rand(0,100); // php variable number1 ie n1 will have a random number inclusive of 0 and 100 you can use rand() also
$n2=mt_rand(0,100);
?>
What is <?php echo $n1; ?> + <?php echo $n2; ?> <!-- wrinting the question -->
<input type='text' id='result' /> <!-- Textbox for the result -->
<br/>
<input type='button','.$n2;?>)' value='OK' /><br/><!-- onClick funtion ni will triger with the values in the question -->
<br/> <!-- new line-->
Time spent on the question so far is <span id="seconds"></span> seconds <!-- shows the timer-->
</body>
</html>
<script type='text/javascript'>
function ni(n1,n2)
{
var result = document.getElementById('result');
if(result.value == n1+n2)
{
alert("You are correct!!"); // alert the message you are correct
result.value=''; // reset the result , ie inupt textbox
location.reload(); // reload the page
}
else
{
alert("You are Wrong, Try again"); // alert you are wrong
result.value=''; // reset the result
}
}
var sec = 0; // at the time of load set to zero
function pad ( val ) { return val; } // function pad return the values ie val seconds
setInterval( function(){
document.getElementById("seconds").innerHTML=pad(++sec);
//document.getElementById("minutes").innerHTML=pad(parseInt(sec/60,10)); // can be used for minutes then pad(++sec) should be like pad(++sec%60)
}, 1000);
</script>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.