Advertisement
firoze

increament and decreament loop in Javascript and php

May 4th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1.  
  2. //increment and decrements loop in Javascript
  3. <script>
  4. // Decrements loop in JavaScript
  5. var Counter_array = Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,true,false),
  6. len = Counter_array.length;
  7.  
  8. for(var i = len; i > 0; i = i-1){
  9. window.document.write(i);
  10. window.document.write('<br />');
  11. }
  12.  
  13.  
  14. // Increment loop in JavaScript
  15. var Counter_array = Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,true,false),
  16. len = Counter_array.length;
  17.  
  18. for(var i = 0; i < len; i = i+1){
  19. window.document.write(i);
  20. window.document.write('<br />');
  21. }
  22. </script>
  23.  
  24.  
  25.  
  26. // increment and decrements loop in php
  27.  
  28. // Decremented loop in php
  29. <select>
  30. <?php
  31. for($i = 30;$i>=10;$i=$i-1){
  32. echo "<option value ='$i'>$i</option>";
  33. }
  34. ?>
  35.  
  36. </select>
  37.  
  38.  
  39.  
  40. // increment loop in php
  41. <select>
  42. <?php
  43. for($i = 0;$i<=30;$i=$i+1){
  44. echo "<option value ='$i'>$i</option>";
  45. }
  46. ?>
  47.  
  48. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement