Closed Thread
Results 1 to 2 of 2

Thread: JS Array, what am i doing wrong?

  1. #1
    zeroradius's Avatar
    zeroradius is offline Speaks fluent binary
    Join Date
    Feb 2008
    Location
    Ohio
    Posts
    1,403
    Rep Power
    25

    JS Array, what am i doing wrong?

    I hardly ever use javascript and when i do it is only alert() so my problem is probably easily resolves but i have checked books and w3schools and cannot find the problem.

    I cant get the pic[1] to write out to the screen
    note: I also tried declaring it var pic=new array()
    Code:
              	<script type='text/javascript'>
    var pic[];
     pic[0] = 'gallery/1.jpg'; 
    pic[1] = 'gallery/10.jpg';
     pic[2] = 'gallery/2.jpg';
     pic[3] = 'gallery/3.jpg';
     pic[4] = 'gallery/4.jpg';
     pic[5] = 'gallery/5.jpg';
     pic[6] = 'gallery/6.jpg'; 
    pic[7] = 'gallery/7.jpg'; 
    pic[8] = 'gallery/8.jpg';
     pic[9] = 'gallery/9.jpg';
    document.write(pic[1]);document.write(pic[2]);
    </script>
    Edit........ N/M turns out the A in new Array() has to be capitalised, working now

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: JS Array, what am i doing wrong?

    try var pic = new Array();, javascript is case sensitive

    Hope that helps

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 09-22-2011, 04:59 PM
  2. Replies: 5
    Last Post: 08-01-2011, 07:52 AM
  3. Export Array Contents in String Then Read Into Array Later
    By rsnider19 in forum PHP Development
    Replies: 3
    Last Post: 08-20-2010, 02:31 AM
  4. Android converting short array to byte array using java on android device.
    By maxsap in forum Mobile Development
    Replies: 0
    Last Post: 04-26-2010, 04:14 AM
  5. Replies: 0
    Last Post: 04-26-2010, 04:14 AM

Tags for this Thread

Bookmarks

Posting Permissions

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