SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict ghostme's Avatar
    Join Date
    Feb 2005
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to output a preload image sequence in a for loop

    Hello i wrote js preload script thus:
    shola=new Array();
    shola[1]=new Image();
    shola[1]="me.gif"'
    shola[2]=.....
    pls how do i output this in for loop statement

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,499
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    var 
    Path="http://www.vicsjavascripts.org.uk/StdImages/';
    var ImageAry=new Array('One.gif','Two.gif','Three.gif');

    var shola=new Array();

    for (i=0;i<ImageAry.length;i++){
     shola[i]=new Image();
     shola[i].src=Path+ImageAry[i];
    }

    //-->
    </script> 

  3. #3
    SitePoint Wizard Young Twig's Avatar
    Join Date
    Dec 2003
    Location
    Albany, New York
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heh... Little error with your quotes.

    HTML Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    var Path='http://www.vicsjavascripts.org.uk/StdImages/';
    var ImageAry=new Array('One.gif','Two.gif','Three.gif');
    
    var shola=new Array();
    
    for (i=0;i<ImageAry.length;i++){
    shola[i]=new Image();
    shola[i].src=Path+ImageAry[i];
    }
    
    //-->
    </script> 

  4. #4
    SitePoint Addict ghostme's Avatar
    Join Date
    Feb 2005
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    thanks for the reply

    hello guys thanks for the reply i see how it works and will give y'all a feedback


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
  •