Facebook
From xxx, 5 Years ago, written in JavaScript.
This paste is a reply to petle from xxx - view diff
Embed
Download Paste or View Raw
Hits: 354
  1. <html>
  2.     <head>
  3.         <title></title>
  4.         <meta charset="UTF-8">
  5.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     </head>
  7.     <body>
  8.         <div>Pętle</div>
  9.         <script>
  10.  
  11.             for (var x = 1; x < 10; x = x + 1) {
  12.                 // tu będzie powtarzalny blok kodu
  13.                 document.write("pętla uruchomiona " + x + " razy ");
  14.             }
  15.  
  16.             for (x = 0; x < 255; x++) {
  17. //                document.write("<div style='height:3px;background-color: rgb(0,"+x+",0)'");
  18.                 pomoc = "<div style='height:3px;background-color: rgb(0,";
  19.                 pomoc = pomoc + x;
  20.                 pomoc = pomoc + ",0)'></div>";
  21.                 console.log(pomoc);
  22.                 document.write(pomoc);
  23.             }
  24.  
  25.             for (x = 255; x >= 0; x--) {    // x = x - 1
  26.                 pomoc = '<div style="height:3px;background-color: rgb(0,';
  27.                 pomoc = pomoc + x;
  28.                 pomoc = pomoc + ',0)"></div>';
  29.                 console.log(pomoc);
  30.                 document.write(pomoc);
  31.             }
  32.  
  33.         </script>
  34.  
  35.         <div style="background-color: rgb (0,0,0); height: 3px">          
  36.         </div>
  37.  
  38.     </body>
  39. </html>
  40.