Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default image array problem

    Hi,

    I'm trying to do an image slide show, when the next button is clicked it calls
    the function below and increments the index of the image array by 1, and
    changes the image. It doesnt seem to be working, can anybody help?

    Thanks



    --------------------------------------------------------------------------------
    --
    <script language="JavaScript">
    var myimages = new Array("1.jpg","2.jpg","3.jpg","4.jpg");
    var imgindex = 1;
    document.images["img1"].src = myimages[imgindex];

    function next()
    {
    imgindex = imgindex + 1;
    }
    </script>

    Mattastic Guest

  2. Similar Questions and Discussions

    1. Convert image into byte array
      I am trying to insert an image in the word document using RTF specifiations. The problem i am facing is that in RTF we have to provide a byte string...
    2. XML-RPC problem with array
      Hello I have compiled my php with --with-xmlrpc option to use xmlrpc server. Everything works fine, but there is one problem. Array (indexed...
    3. Array problem
      I thought I understood how to traverse an array, but I guess I was wrong. I have tried writing the code snippet below as: while, for, foreach... and...
    4. PHP array problem
      Hi all, i'm having a problem concerning arrays. I am using an array that is stored in a mysql dbase. First i store this array in a variable like:...
    5. Array Problem - Help!
      Im having a problem with an array that is put into a session. I want to be able to remove any element, but when I loop through to display them, it...
  3. #2

    Default Re: image array problem

    <script language="JavaScript">
    var myimages = new Array("1.jpg","2.jpg","3.jpg","4.jpg");
    var imgindex = 0;

    function next(){
    document.images["img1"].src = myimages[imgindex++];
    if(imgindex==myimages.length){imgindex=0}
    }
    </script>

    <a href="#" onclick="next()">Click</a>
    Mick

    Mattastic wrote:
    > Hi,
    >
    > I'm trying to do an image slide show, when the next button is clicked it calls
    > the function below and increments the index of the image array by 1, and
    > changes the image. It doesnt seem to be working, can anybody help?
    >
    > Thanks
    >
    >
    >
    > --------------------------------------------------------------------------------
    > --
    > <script language="JavaScript">
    > var myimages = new Array("1.jpg","2.jpg","3.jpg","4.jpg");
    > var imgindex = 1;
    > document.images["img1"].src = myimages[imgindex];
    >
    > function next()
    > {
    > imgindex = imgindex + 1;
    > }
    > </script>
    >
    Mick White Guest

  4. #3

    Default Re: image array problem

    [L=Text]http://abcteach.com[/L][E=Text]booboo19912003@yahoo.com[/E]
    hi would love to help but im new to making websites i start on a few but never finshed any!!
    baby_girl_2004 Guest

  5. #4

    Default Re: image array problem

    Meet My Evil Sister ^^^

    <Correction> Post has Been Corrected
    Post Name: __user__
    Username:__baby_girl_2004__

    Link 1: [url]http://www.abcteach.com/Forums[/url]

    Link 2 : [email]booboo1992003@yahoo.com[/email]

    ?ark Templer Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139