Advertisement
DrunkSpinda

Untitled

Nov 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Jogo do galo</title>
  5. </head>
  6. <style type="text/css">
  7.  
  8. table{
  9. margin: auto;
  10. border: 3px solid black;
  11. border-collapse: collapse;
  12. }
  13.  
  14. td{
  15. border: 3px solid black;
  16. border-collapse: collapse;
  17. width: 100px;
  18. height: 100px;
  19.  
  20. }
  21.  
  22. </style>
  23. <body>
  24. <table>
  25. <tr>
  26. <td id="1" onclick="marca()"></td>
  27. <td id="2" onclick="marca()"></td>
  28. <td id="3" onclick="marca()"></td>
  29. </tr>
  30. <tr>
  31. <td id="4" onclick="marca()"></td>
  32. <td id="5" onclick="marca()"></td>
  33. <td id="6" onclick="marca()"></td>
  34. </tr>
  35. <tr>
  36. <td id="7" onclick="marca()"></td>
  37. <td id="8" onclick="marca()"></td>
  38. <td id="9" onclick="marca()"></td>
  39. </tr>
  40. </table>
  41. </body>
  42. <script type="text/javascript">
  43.  
  44. var v=parseInt("1");
  45.  
  46. function marca(x){
  47.  
  48. if (v==1) {
  49. document.getElementById('x').innerHTML = "X";
  50. v=0;
  51. }
  52.  
  53. else{
  54. if (v==0) {
  55. document.getElementById('x').innerHTML = "O";
  56. v==1;
  57. }
  58. }
  59. }
  60.  
  61. </script>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement