What I have done is in the <script>
IST wants a prize draw quiz page for their website. The page has already been started. You are
required to complete it.
Open ISTDraw.html in your browser.
Users enter their choices, 1, 2, or 3, in the boxes with input ids: Answer1, Answer2, and Answer3
and click on âTest your answersâ.
The correct answers for the quiz are:
1. International Ski Tours â (option 2)
2. Luxury accommodation â (option 3)
3. All the family â (option 2)
Using ISTDraw.html add the JavaScript code to achieve the following:
⢠When users click to submit their choices, the script must display an alert displaying the number of correct answers and suitable explanatory text
⢠When the alert is dismissed the number of correct answers must be displayed in the box with input id =âcountâ under the âNumber of correct answersâ label
⢠For 3 correct answers display the text, âWell doneâ at the id=âresponseâ placeholder under the count box*.*
o the text âEnter drawâ should appear at the id=âEnterâ placeholder under the Prize Draw Quick Quiz heading
<html>
<body>
<h3>Prize Draw Quick Quiz</h3>
<!--Enter placeholder -->
<h3 id="Enter"></h3>
<h2>Enter your choices 1,2,or 3 in the answer boxes </h2>
</div><br>
What does IST stand for?<br>
1.International Snow Travel<br>
2. International Ski Tours<br>
3. International Ski Travel<br>
Answer 1.
<!--Answer1 input box -->
<input id="Answer1" type="number" ><br><br>
What sort of accommodation does IST provide?<br>
Budget accommodation<br>
Deluxe accommodation<br>
Luxury accommodation<br>
Answer 2.
<!--Answer2 input box -->
<input id="Answer2" type="number" ><br><br>
Who does IST provide fun for?<br>
Children<br>
All the family<br>
Adults<br>
Answer 3.
<!--Answer3 input box -->
<input id="Answer3" type="number" ><br><br>
<button type="button" onClick="myFunction()">Test your answers</button>
<br>
<p>Number of correct answers</p>
<!--count input box -->
<input id="count"type="number">
</p>
<!--reponse placeholder -->
<p id="response"> </p>
<SCRIPT LANGUAGE="JavaScript">
var result=0
function myFunction() {
var ans1=document.getElementById("Answer1").value
if (ans1=="") {alert("Please Answer Q1")}
else if (ans1==2) {result++}
}
function myFunction() {
var ans2=document.getElementById("Answer2").value
if (ans2=="") {alert("Please Answer Q2")}
else if (ans2==3) {result++}
}
function myFunction() {
var ans3=document.getElementById("Answer3").value
if (ans3=="") {alert("Please Answer Q3")}
else if (ans3==2) {result++}
}
function myFunction() {
alert(result)
</SCRIPT>
</body>
</html>