Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <HEAD>
- <style type="text/css">
- <!--
- body {
- background=color: #000;
- color: white;
- font-weight: bold;
- }
- -->
- </style>
- <script language="JavaScript">
- // Insert number of questions
- var numQues = 6;
- // Insert number of choice in each question
- var numChoi = 3;
- // Insert number of questions to be displayed in answer area
- var answers = new Array(6);
- // Insert answers to questions
- answers[0] = "Charr";
- answers[1] = "Eight";
- answers[2] = "Dwarves";
- answers[3] = "Heavy";
- answers[4] = "Player vs Player";
- answers[5] = "Tyria";
- // Loops through each question and each choice and compares selected option to correct answer
- function getScore(form){
- var score = 0;
- var currElt;
- var currSelection;
- var p=0;
- while(p<1){
- for (i=0; i<numQues; i++) {
- currElt = i*numChoi;
- for (j=0; j<numChoi; j++) {
- currSelection = form.elements[currElt + j];
- if (currSelection.checked) {
- if (currSelection.value == answers[i]) {
- score++;
- break;
- }
- }
- }
- }
- p++;
- }
- // calculates % score
- score = Math.round(score/numQues*100);
- // assigns % score to value of text box
- form.percentage.value = score + "%";
- // assigns correct answers array to value of textarea box
- var correctAnswers = "";
- for (i=1; i<=numQues; i++) {
- correctAnswers += i + ". " + answers[i-1] + "\r\n";
- }
- form.solutions.value = correctAnswers;
- }
- </script>
- </HEAD>
- <BODY>
- <h3>Guild Wars 2 Quiz</h3>
- <form name="quiz">
- <DL><DT>1. Which Guild Wars 2 playable race was previously an ememy in the first game?
- <DD><input type="radio" name="q1" value="Humans">Humans
- <DD><input type="radio" name="q1" value="Norn">Norn
- <DD><input type="radio" name="q1" value="Charr">Charr
- </DL>
- <DL><DT>2. How many proffesions are there to choose from in Guild Wars 2?
- <DD><input type="radio" name="q2" value="Five">Five
- <DD><input type="radio" name="q2" value="Eight">Eight
- <DD><input type="radio" name="q2" value="Ten">Ten
- </DL>
- <DL><DT>3. Which is not a playable race in Guild Wars 2?
- <DD><input type="radio" name="q3" value="Sylvari">Sylvari
- <DD><input type="radio" name="q3" value="Dwarves">Dwarves
- <DD><input type="radio" name="q3" value="Asura">Asura
- </DL>
- <DL><DT>4. Which of these is a correct class of gear in Guild Wars 2?
- <DD><input type="radio" name="q4" value="Heavy">Heavy
- <DD><input type="radio" name="q4" value="Plate">Plate
- <DD><input type="radio" name="q4" value="Chain">Chain
- </DL>
- <DL><DT>5. In Guild Wars 2 and other MMOs, what does PVP stand for?
- <DD><input type="radio" name="q5" value="Person vs Person">Person vs Person
- <DD><input type="radio" name="q5" value="Popular Versatile Precision">Popular Versatile Precision
- <DD><input type="radio" name="q5" value="Player vs Player">Player vs Player
- </DL>
- <DL><DT>6. What ficticious world is Guild Wars 2 set in?
- <DD><input type="radio" name="q6" value="Tamriel">Tamriel
- <DD><input type="radio" name="q6" value="Azeroth">Azeroth
- <DD><input type="radio" name="q6" value="Tyria">Tyria
- </DL>
- <input type="button" value="Get score" onClick="getScore(this.form)">
- <input type="reset" value="Clear answers">
- <p> Score = <strong><input class="bgclr" type="text" size="5" name="percentage" disabled></strong><br><br>
- Correct answers:<br>
- <textarea class="bgclr" name="solutions" wrap="virtual" rows="6" cols="30" disabled>
- </textarea>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment