Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <p id="kort"></p>
- Kort kvar = <p id="kort2"></p><br>
- <input type="button" value="Reset" onClick="document.location.reload(true)">
- <button type="button" onClick=(next_card())>Nästa kort!</button>
- <button type="button" onClick=(show_card())>Visa kort</button>
- <br>
- <script>
- var myArray = [2, 3, 4, 5, 6, 7, 8, 9, 10, "Knekt", "Dam", "Kung", "Ess"];
- myArray.sort(function() {return 0.5 - Math.random()});
- document.getElementById("kort").innerHTML = myArray[0];
- document.getElementById("kort2").innerHTML = myArray.length;
- function next_card()
- {
- myArray.shift();
- document.getElementById("kort").innerHTML = myArray[0];
- document.getElementById("kort2").innerHTML = myArray.length;
- }
- function show_card()
- {
- window.alert(myArray.length);
- }
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement