Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <!--Template HTML page: copypasta; do NOT modify this file directly!-->
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title>Sample Quiz</title>
- <style type="text/css">
- </style>
- <script type="text/javascript">
- var questions = [
- {
- question: "Q1 blah blah blah",
- answers: [ "ans1.1", "ans1.2", "ans1.3", "ans1.4" ]
- },
- {
- question: "Q2 blah blah blah",
- answers: [ "ans2.1", "ans2.2", "ans2.3", "ans2.4" ]
- },
- {
- question: "Q3 blah blah blah",
- answers: [ "ans3.1", "ans3.2", "ans3.3", "ans3.4" ]
- },
- {
- question: "Q4 blah blah blah",
- answers: [ "ans4.1", "ans4.2", "ans4.3", "ans4.4" ]
- },
- {
- question: "Q5 blah blah blah",
- answers: [ "ans5.1", "ans5.2", "ans5.3", "ans5.4" ]
- },
- {
- question: "Q6 blah blah blah",
- answers: [ "ans6.1", "ans6.2", "ans6.3", "ans6.4" ]
- },
- {
- question: "Q7 blah blah blah",
- answers: [ "ans7.1", "ans7.2", "ans7.3", "ans7.4" ]
- },
- {
- question: "Q8 blah blah blah",
- answers: [ "ans8.1", "ans8.2", "ans8.3", "ans8.4" ]
- },
- {
- question: "Q9 blah blah blah",
- answers: [ "ans9.1", "ans9.2", "ans9.3", "ans9.4" ]
- },
- {
- question: "Q10 blah blah blah",
- answers: [ "ans10.1", "ans10.2", "ans10.3", "ans10.4" ]
- }
- ];
- var qnum = 1;
- while (true) {
- document.write("blah blah blah","<br/>");
- var reply = prompt("Response?");
- if (reply == "no") {
- break;
- }
- else if (reply == "yes") {
- while (qnum <= 10) {
- document.write ("<table border = 1>");
- // Generate random question
- var rand = Math.floor(Math.random() * 10);
- document.write(qnum,". ");
- document.write(questions[rand].question,"<br/>");
- for (i = 0; i < questions[rand].answers.length; i++) {
- document.write("<td>",questions[rand].answers[i],"</td>");
- }
- document.write("</table>");
- var answer = prompt("Answer goes here");
- qnum++;
- }
- }
- if (qnum == 10) {
- break;
- }
- }
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement