Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    147
    Thanks
    31
    Thanked 2 Times in 2 Posts

    for loop not working

    Hi Why wont my for loop work

    it wont alert the var images1....

    Thanks




    Code:
    <script type="text/javascript">
    
    for(i=1;i<6;i++){
    	
    	images[i] = "no"+i+".jpg";
    	alert(images[i]);
    }
    
    </script>

  • #2
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    Declare the variable images;

    Code:
    var images = [] or var images = new Array()

  • Users who have thanked ckeyrouz for this post:

    andrew1234 (07-17-2009)

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Posts
    147
    Thanks
    31
    Thanked 2 Times in 2 Posts
    thanks so much


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •