Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. html>
  2. <head>
  3. <title> Kolko i krzyzyk ver 1.0 </title>
  4.  
  5. <style>
  6. .przycisk {
  7. width:200px;
  8. height:200px;
  9. background-color:black;
  10. color:blue;
  11. font-size:150px;
  12. font-weight:bold;
  13. text-shadow: 6px 6px 13px red;
  14. }
  15. </style>
  16.  
  17. <script>
  18. var krzyzyk=false;
  19. function wstaw(nr)
  20. {
  21. if(document.getElementById(nr).value=="")
  22. {
  23. if (krzyzyk==false)
  24. {
  25. document.getElementById(nr).value='X';
  26. krzyzyk=true;
  27.  
  28. }
  29. else
  30. {
  31. document.getElementById(nr).value='O';
  32. krzyzyk=false;
  33. }
  34. }
  35. }
  36.  
  37. function sprawdz(a,b,c,znak)
  38. {
  39. let x,y,z,w;
  40. x=document.getElementById(a).value;
  41. y=document.getElementById(b).value;
  42. z=document.getElementById(c).value;
  43. if((x==y)&&(y==z)&&(z==znak)) return true;
  44. else return false;
  45.  
  46. }
  47. function sprawdzenie()
  48. {
  49. if(sprawdz('button1','button2','button3','X')) alert("Wygrał X");
  50.  
  51. }
  52.  
  53.  
  54. </script>
  55. </head>
  56. <body>
  57. <div><center>
  58. <input class="przycisk" type="button" id="button1" onclick="wstaw('button1')">
  59. <input class="przycisk" type="button" id="button2" onclick="wstaw('button2')">
  60. <input class="przycisk" type="button" id="button3" onclick="wstaw('button3')"><br>
  61. <input class="przycisk" type="button" id="button4" onclick="wstaw('button4')">
  62. <input class="przycisk" type="button" id="button5" onclick="wstaw('button5')">
  63. <input class="przycisk" type="button" id="button6" onclick="wstaw('button6')"> <br>
  64. <input class="przycisk" type="button" id="button7" onclick="wstaw('button7')">
  65. <input class="przycisk" type="button" id="button8" onclick="wstaw('button8')">
  66. <input class="przycisk" type="button" id="button9" onclick="wstaw('button9')"><br>
  67. </div></center>
  68. </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement