Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>jsdo</title>
- <script>
- </script>
- <style>
- *{
- box-sizing: border-box;
- }
- .galeria{
- display: flex;
- flex-wrap: wrap;
- height: 384px;
- width: 384px;
- }
- .galeria>div{
- width: 100px;
- margin: 10px;
- text-align: center;
- line-height: 75px;
- font-size: 30px;
- }
- img{
- width: 100px;
- height: 100px;
- }
- </style>
- </head>
- <body>
- <div class="galeria">
- <div id="1"><img src="1push.png"/></div>
- <div id="2"><img src="1push.png"/></div>
- <div id="3"><img src="1push.png"/></div>
- <div id="4"><img src="1push.png"/></div>
- <div id="5"><img src="1push.png"/></div>
- <div id="6"><img src="1push.png"/></div>
- <div id="7"><img src="1push.png"/></div>
- <div id="8"><img src="1push.png"/></div>
- <div id="9"><img src="1push.png"/></div>
- </div>
- </br>
- <button id="goCat">KlickHere</button>
- <script>
- var button = document.getElementById("goCat");
- button.addEventListener("click", function(){
- for(var i=1; i<10; i++){
- var randPush = Math.floor((Math.random() *4)) + 1;
- console.log(randPush);
- document.getElementById(i).innerHTML = `<img src="${randPush}push.png"/>`;
- }
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement