question about IMG an Arrays- asap

Discussion in 'JavaScript' started by progfrog, May 1, 2008.

  1. #1
    Hi Guys!
    This is My question:
    i have an array with 3 IMGS
    Here it is:
    
    
                            var Pics = new Array();
                            var Index = 0;
                            Pics[0] = new Image();
                            Pics[0].src = "images/pic_1.jpg";
                            Pics[1] = new Image();
                            Pics[1].src = "images/guitar.jpg";
                            Pics[2] = new Image();
                            Pics[2].src = "images/contrabas.jpg";
    
    
    
    
    
    
    Code (markup):

    I would like them to be effected from a class in a css file that contain the shape orders for the pictures. how can I give the cells in the array this class? how do i write it? how can i acsses the cells in the array or can I give the array itself the class? something like: pics.style.class="1"?
    anyway I need you..

    thanx:)
    Prog frog
     
    progfrog, May 1, 2008 IP
  2. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've honestly never worked with loading images by doing "new Image()" but if you can set the source by doing .src the same way you would with a real <img> tag, then you might be able to do .className the same way you're doing the .src

    Pics[0].className = "1";

    Etc. Not sure if it'd work completely though..
     
    zerxer, May 1, 2008 IP