Advertisement
krzychna33

Untitled

Dec 11th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.25 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>jsdo</title>
  6.     <script>
  7.     </script>
  8.     <style>
  9.         *{
  10.             box-sizing: border-box;
  11.         }
  12.         .galeria{
  13.             display: flex;
  14.             flex-wrap: wrap;
  15.             height: 384px;
  16.             width: 384px;
  17.         }
  18.         .galeria>div{
  19.             width: 100px;
  20.             margin: 10px;
  21.             text-align: center;
  22.             line-height: 75px;
  23.             font-size: 30px;
  24.         }
  25.         img{
  26.             width: 100px;
  27.             height: 100px;
  28.         }
  29.    
  30.     </style>
  31. </head>
  32. <body>
  33.  
  34. <div class="galeria">
  35. <div id="1"><img src="1push.png"/></div>
  36. <div id="2"><img src="1push.png"/></div>
  37. <div id="3"><img src="1push.png"/></div>
  38. <div id="4"><img src="1push.png"/></div>
  39. <div id="5"><img src="1push.png"/></div>
  40. <div id="6"><img src="1push.png"/></div>
  41. <div id="7"><img src="1push.png"/></div>
  42. <div id="8"><img src="1push.png"/></div>
  43. <div id="9"><img src="1push.png"/></div>
  44. </div>
  45. </br>
  46. <button id="goCat">KlickHere</button>
  47.  
  48. <script>
  49.     var button = document.getElementById("goCat");
  50.  
  51.     button.addEventListener("click", function(){
  52.         for(var i=1; i<10; i++){
  53.             var randPush = Math.floor((Math.random() *4)) + 1;
  54.             console.log(randPush);
  55.             document.getElementById(i).innerHTML = `<img src="${randPush}push.png"/>`;
  56.         }
  57.     });
  58.  
  59. </script>
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement