Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script src="jquery.js"></script>
- <script>
- var cardidx = 0;
- var deck = [["question 1","answer 1"],["question 2","answer 2"],["question 3","answer 3"]];
- function shownextcard() {
- if(cardidx == deck.length - 1) {
- cardidx = 0;
- } else {
- cardidx = cardidx + 1;
- }
- $("#card").html(deck[cardidx][0]);
- }
- function showanswer() {
- $("#card").html(deck[cardidx][1]);
- }
- function init() {
- $("#right").click(shownextcard);
- $("#wrong").click(showanswer);
- }
- $(document).ready(init);
- </script>
- </head>
- <body>
- <div id="card" style="width:300px;height:200px;border-style:solid">test</div>
- <button id="right">right</button>
- <button id="wrong">wrong</button>
- </body>
- </html>
Add Comment
Please, Sign In to add comment