SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7.     <title>Document</title>
  8. </head>
  9. <body>
  10. <style type="text/css">
  11. :root
  12.     {
  13.         background-color: #2f3237;
  14.         font-family: 'Courier New', Courier, monospace;
  15.     }
  16. .a{
  17.     color: white;
  18. }
  19. div{
  20.     margin-top: 70px;
  21.     width: 300px;
  22.     height: 100px;
  23.     margin-left: auto;
  24.     margin-right: auto;
  25.     background-color: #1f3237;
  26.     text-align: center;
  27.     border: 1px solid red;
  28.     border-radius: 10px;
  29. }
  30. button{
  31.     background-color: black;
  32.     color: white;
  33.     border-radius: 16px;
  34.     width: 200px;
  35.     height: 30px;
  36.     border: 1px solid red;
  37.     cursor:pointer;
  38.     outline: none;
  39. }
  40.  
  41. </style>
  42.    <div>
  43.    <p id="color-inner"></p>
  44.    <button onClick="randomColor()">Wylosuj losowy kolor</button>
  45.    </div>
  46. <script>
  47.     function randomColor(){
  48.         const zakres = "0123456789ABCDEF";
  49.         const text = document.getElementById('color-inner');
  50.         let kolor = "#";
  51.  
  52.             for(i=0;i<6;i++){
  53.                 kolor += zakres[Math.floor(Math.random()*16)];
  54.             }
  55.            
  56.             text.innerHTML = "<span class='a'>Twój kolor to: </span>" + kolor;
  57.             text.style.color = kolor;
  58.     }
  59. randomColor();
  60. </script>
  61.  
  62.  
  63.  
  64.  
  65. </body>
  66. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top