|
| 1 | +JavaScript-Quiz |
| 2 | +=============== |
| 3 | + |
| 4 | +A simple quiz template written in js/jquery and is responsively designed. |
| 5 | + |
| 6 | +In the future, I will add a generator to add questions, etc. |
| 7 | + |
| 8 | +To use, open the file in a text editor like [TextMate (Mac)](http://macromates.com/) or [Notepad++ (PC)](http://notepad-plus-plus.org/) and edit the data at the top of the document. |
| 9 | + |
| 10 | +```javascript |
| 11 | +var quiz = [ |
| 12 | + { |
| 13 | + "question" : "Q1: Who came up with the theory of relativity?", |
| 14 | + "image" : "http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Albert_Einstein_Head.jpg/220px-Albert_Einstein_Head.jpg", |
| 15 | + "choices" : [ |
| 16 | + "Sir Isaac Newton", |
| 17 | + "Nicolaus Copernicus", |
| 18 | + "Albert Einstein", |
| 19 | + "Ralph Waldo Emmerson" |
| 20 | + ], |
| 21 | + "correct" : "Albert Einstein", |
| 22 | + "explanation" : "Albert Einstein drafted the special theory of relativity in 1905.", |
| 23 | + }, |
| 24 | + { |
| 25 | + "question" : "Q2: Who is on the two dollar bill?", |
| 26 | + "image" : "http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/US_%242_obverse-high.jpg/320px-US_%242_obverse-high.jpg", |
| 27 | + "choices" : [ |
| 28 | + "Thomas Jefferson", |
| 29 | + "Dwight D. Eisenhower", |
| 30 | + "Benjamin Franklin", |
| 31 | + "Abraham Lincoln" |
| 32 | + ], |
| 33 | + "correct" : "Thomas Jefferson", |
| 34 | + "explanation" : "The two dollar bill is seldom seen in circulation. As a result, some businesses are confused when presented with the note.", |
| 35 | + }, |
| 36 | + { |
| 37 | + "question" : "Q3: What event began on April 12, 1861?", |
| 38 | + "image" : "", |
| 39 | + "choices" : [ |
| 40 | + "First manned flight", |
| 41 | + "California became a state", |
| 42 | + "American Civil War began", |
| 43 | + "Declaration of Independence" |
| 44 | + ], |
| 45 | + "correct" : "American Civil War began", |
| 46 | + "explanation" : "South Carolina came under attack when Confederate soldiers attacked Fort Sumter. The war lasted until April 9th 1865.", |
| 47 | + }, |
| 48 | + |
| 49 | +]; |
| 50 | +``` |
| 51 | + |
| 52 | +It's important that the correct answer match one of the choices _exactly_. |
| 53 | + |
| 54 | +Images are optional, but you should keep the empty quotes. Every item must be proceeded by a comma except for the last item in a set. |
| 55 | + |
| 56 | +To add an additional question, copy the entire curly bracket block: |
| 57 | +```javascript |
| 58 | +{ |
| 59 | + "question" : "Q3: What event began on April 12, 1861?", |
| 60 | + "image" : "", |
| 61 | + "choices" : [ |
| 62 | + "First manned flight", |
| 63 | + "California became a state", |
| 64 | + "American Civil War began", |
| 65 | + "Declaration of Independence" |
| 66 | + ], |
| 67 | + "correct" : "American Civil War began", |
| 68 | + "explanation" : "South Carolina came under attack when Confederate soldiers attacked Fort Sumter. The war lasted until April 9th 1865.", |
| 69 | +}, |
| 70 | +``` |
| 71 | +There is also a variable at the top to add the quiz title. |
0 commit comments