Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default Javacript Functions

    Is there any way I can make a javascript function go through all the images in a directory? Or through images which are listed?

    I could use

    HTML Code:
     var image = '1'
    
    function ChangeBG1()
    {
        image = image+1;
    
    }
    So it goes threw files called 1,2,3,4,5 but once it reaches the end it won't go back to 1.

    Thanks.

    Edit: Its to change the background of a div when you click something :p

    Moved by Agesilaus (Forum Moderator) from Design & Development: Please post in the correct forum next time.
    Last edited by Agesilaus; 02-01-2008 at 05:49 AM.

  2. #2
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Sorry to double post, i found a way around that, I just need one more thing.
    I need it to send a URL into a form

    The js is:
    PHP Code:
    <script language="javascript">
    var 
    hi_list = [1];
    function 
    changeimg(act,a){
        switch (
    a){
            case 
    0hi_list[act] = hi_list[act]+1;
            if(
    hi_list[act] > 10){hi_list[act] = 1;}
            break;
            case 
    1hi_list[act] = hi_list[act]-1;
            if(
    hi_list[act] < 1){hi_list[act] = 10;}
            break;
        }
        
    n_src 'http://habbcrazy.net/test/images/'+hi_list[0]+'.gif';
        
    window.document.images['habboimg'].src n_src;
        
    form.urlpreview.value 'http://habbcrazy.net/test/images/'+hi_list[0]+'.gif';

    }    
    </
    script
    I tried this one, but didnt work (The field ID is "urlpreview")
    PHP Code:
        form.urlpreview.value 'http://habbcrazy.net/test/images/'+hi_list[0]+'.gif'

Posting Permissions

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