USING HTML AND JAVASCRIPT PROVIDED 1. Provide the following information: First N
ID: 3794002 • Letter: U
Question
USING HTML AND JAVASCRIPT PROVIDED
1. Provide the following information: First Name, Last Name, and Email for Assessment. (validate input).
2. Take a Test/Quiz (minimum 5 multiple choice questions).
3. Submit the result of the Test/Quiz.
Note: The following information should be available on the different document/window:
a. Information about student,
b. Total grade (%)
c. Statistics (Example: Q1 – wrong /correct).
HTML CODE:
<!DOCTYPE html>
<html>
<head>
<title>Round trip</title>
<script type="text/javascript" src="quiz.js"></script>
</head>
<body>
<ol>
<!--answer: Hypertext markup language-->
<li>
<h3>What does HTML stand For</h3>
<input type="radio" name="question0" value="A">Home took Markup Language<br>
<input type="radio" name="question0" value="B">Hypertext Markup Language<br>
<input type="radio" name="question0" value="C">Hyperlinks and Text Markup Language<br>
<input type="radio" name="question0" value="D">I don't know<br>
</li>
<!--answer: World wide web consortium-->
<li>
<h3>Who is making Web Standards</h3>
<input type="radio" name="question1" value="A">Mozilla<br>
<input type="radio" name="question1" value="B">The World Wide Web Consortium<br>
<input type="radio" name="question1" value="C">Google<br>
<input type="radio" name="question1" value="D">Microsoft<br>
</li>
<!--answer: h1-->
<li>
<h3>Choose the correct HTML element fo the largest heading:</h3>
<input type="radio" name="question2" value="A">heading<br>
<input type="radio" name="question2" value="B">h1<br>
<input type="radio" name="question2" value="C">head<br>
<input type="radio" name="question2" value="D">h6<br>
</li>
<!--answer: strong-->
<li>
<h3>Choose the correct HTML element to define important text:</h3>
<input type="radio" name="question3" value="A">important<br>
<input type="radio" name="question3" value="B">i<br>
<input type="radio" name="question3" value="C">strong<br>
<input type="radio" name="question3" value="D">b<br>
</li>
<!--answer: ol-->
<li>
<h3>How can you make a numbered list?</h3>
<input type="radio" name="question4" value="A">ul<br>
<input type="radio" name="question4" value="B">list<br>
<input type="radio" name="question4" value="C">dl<br>
<input type="radio" name="question4" value="D">ol<br>
</li>
</ol>
<button>View Results</button>
</body>
</html>
JAVASCRIPT CODE:
var answers = ["A","C","B"],
tot = answers.length;
function getCheckedValue( radioName ){
var radios = document.getElementsByName( radioName );
for(var y=0; y<radios.length; y++)
if(radios[y].checked) return radios[y].value;
}
function getScore(){
var score = 0;
for (var i=0; i<tot; i++)
if(getCheckedValue("question"+i)===answers[i]) score += 1;
return score;
}
function returnScore(){
alert("Your score is "+ getScore() +"/"+ tot);
}
Explanation / Answer
<!DOCTYPE html>
<html>
<head>
<title>Round trip</title>
<script type="text/javascript" src="quiz.js"></script>
</head>
<body>
<ol>
<!--answer: Hypertext markup language-->
<li>
<h3>What does HTML stand For</h3>
<input type="radio" name="question0" value="A">Home took Markup Language<br>
<input type="radio" name="question0" value="B">Hypertext Markup Language<br>
<input type="radio" name="question0" value="C">Hyperlinks and Text Markup Language<br>
<input type="radio" name="question0" value="D">I don't know<br>
</li>
<!--answer: World wide web consortium-->
<li>
<h3>Who is making Web Standards</h3>
<input type="radio" name="question1" value="A">Mozilla<br>
<input type="radio" name="question1" value="B">The World Wide Web Consortium<br>
<input type="radio" name="question1" value="C">Google<br>
<input type="radio" name="question1" value="D">Microsoft<br>
</li>
<!--answer: h1-->
<li>
<h3>Choose the correct HTML element fo the largest heading:</h3>
<input type="radio" name="question2" value="A">heading<br>
<input type="radio" name="question2" value="B">h1<br>
<input type="radio" name="question2" value="C">head<br>
<input type="radio" name="question2" value="D">h6<br>
</li>
<!--answer: strong-->
<li>
<h3>Choose the correct HTML element to define important text:</h3>
<input type="radio" name="question3" value="A">important<br>
<input type="radio" name="question3" value="B">i<br>
<input type="radio" name="question3" value="C">strong<br>
<input type="radio" name="question3" value="D">b<br>
</li>
<!--answer: ol-->
<li>
<h3>How can you make a numbered list?</h3>
<input type="radio" name="question4" value="A">ul<br>
<input type="radio" name="question4" value="B">list<br>
<input type="radio" name="question4" value="C">dl<br>
<input type="radio" name="question4" value="D">ol<br>
</li>
</ol>
<button>View Results</button>
</body>
</html>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.