Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.65 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <link rel="stylesheet" type="text/css" href="style.css">
  5.     <meta charset="utf-8">
  6.     <script type="text/javascript">
  7.         var lightR = document.getElementById('r');
  8.         var lightY = document.getElementById('y');
  9.         var lightG = document.getElementById('g');
  10.         function turnOn(){
  11.  
  12.             setInterval('dzialanie()',6000);
  13.  
  14.         }
  15.         function dzialanie(){
  16.  
  17.             setTimeout('jedz()',0);
  18.             setTimeout('zatrzymaj()',2000);
  19.             setTimeout('stop()',3000);
  20.             setTimeout('zolte()',5000);
  21.  
  22.         }
  23.  
  24.         function jedz(){
  25.             lightR.style.background = 'black';
  26.             lightY.style.background = "black";
  27.             lightG.style.background = "green";
  28.         }
  29.  
  30.         function zolte(){
  31.             lightR.style.background = "black";
  32.             lightY.style.background = "yellow";
  33.             lightG.style.background = "black";
  34.         }
  35.  
  36.         function stop(){
  37.             lightR.style.background = "red";
  38.             lightY.style.background = "black";
  39.             lightG.style.background = "black";
  40.         }
  41.  
  42.         function zatrzymaj(){
  43.             lightR.style.background = "black";
  44.             lightY.style.background = "yellow";
  45.             lightG.style.background = "green";
  46.         }
  47.     </script>
  48. </head>
  49. <body>
  50.     <div class="sygnalizator">
  51.         <div id="r" class="light r"></div>
  52.         <div id="y" class="light y"></div>
  53.         <div id="g" class="light g"></div>
  54.     </div>
  55.     <input type="submit" onclick="turnOn()">
  56.  
  57. </body>
  58. </html>
  59.  
  60. <css
  61. .sygnalizator{
  62.     background: black;
  63.     width: 100px;
  64.     min-height: 290px;
  65.     padding-top: 10px;
  66. }
  67.  
  68. .light{
  69.     width: 80px;
  70.     min-height: 80px;
  71.     margin-left: 10px;
  72.     margin-bottom:  10px;
  73.     border-radius: 50px;
  74. }
  75.  
  76. .r{
  77.     background: red;
  78. }
  79.  
  80. .y{
  81.     background: yellow;
  82. }
  83.  
  84. .g{
  85.     background: green;
  86. }
  87. body{
  88.     color: white;
  89. }
  90. >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement