Advertisement
virtualideaz

ForLoopExample.html

Apr 4th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.46 KB | None | 0 0
  1. <html>
  2. <head>
  3.     <title>Using a for loop javascript</title>
  4. </head>
  5. <body>
  6.     <h1>for Loop Example</h1>
  7.     <p>the following is the output of the <b>for</b> loop</p>
  8.     <button onclick=”myfunction()”>Click to try</button>
  9.     <p id=”demo”></p>
  10.  
  11.     <script>
  12.         function myfunction() {
  13.         var i='15';
  14.         for(i=0; i<10; i++;) {
  15.         x = x + “The number is” + i + “</br>”;
  16.         }
  17.         document.getElementById(“demo”).innerHTML= x;
  18.         }
  19.     </script>
  20. </body>
  21. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement