Re: For Loop Help



Thanks for the quick response. At this point I'm just trying to declare the
variables image1, image2, image3, etc. for use later in the script, rather
than typing var image1, image2, . . ., image 20, image21, etc. The "image" +
i code is getting close, I think. Hope this helps to clarify.

Craig

"McKirahan" <News@xxxxxxxxxxxxx> wrote in message
news:Q-2dnfZ5VoCjI4DeRVn-pA@xxxxxxxxxxxxxx
> "Craig L" <w1zard10@xxxxxxxxxxxxxxx> wrote in message
> news:48GdnS5u1MdtJIDeRVn-qg@xxxxxxxxxxxxxx
>> A simple question - How do I convert
>>
>> var image1, image2, image3, image4
>>
>> To a for loop that changes the variable name so I don't have to list
>> them,
>> Like
>>
>> for (var i = 1; i <= 4; i++) {
>> var image??
>> }
>>
>> Thanks for the help.
>
> Not quite sure what you're asking for....
>
> <html>
> <head>
> <title>varImage.htm</title>
> <script type="text/javascript">
>
> var image1 = "a.gif";
> var image2 = "b.gif";
> var image3 = "c.gif";
> var image4 = "d.gif";
>
> // To a for loop that changes the variable name so I don't have to list
> them,
>
> for (var i=1; i<5; i++) {
> alert(eval("image" + i));
> }
>
> // eval() is evil ...
>
> </script>
> </head>
> <body>
> </body>
> </html>
>
>
> http://blogs.msdn.com/ericlippert/archive/2003/11/01/53329.aspx
>
>


.



Relevant Pages

  • Re: DoEvents not working
    ... > to clarify the situation ... ... > I agree that iterating through 10000 records would not give me the ... But as posted in my initial Post, the loop ... > crptStatement (crystal report statement) appear) ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Kiwa MW Air-Core Loop Antenna {In-the-News} FS / FA
    ... Craig and I have been good friends ... and I'm very familiar with his approach to Kiwa ... > spiral grooves for the wire in the PVC pipe core of the MW Loop!). ... > accessories and peripherals like the Kiwa MAP and the Kiwa MW Loop. ...
    (rec.radio.shortwave)
  • Re: How to cycle all possible permutations
    ... >than any mathematical knowledge. ... >I should think there is a for...next loop over a few layers that would ... Can you clarify a bit exactly what you want? ... auric underscore underscore at hotmail dot com ...
    (microsoft.public.excel.programming)
  • Re: VBA Range select
    ... > Alan Beban wrote: ... >> Craig wrote: ... >>> then loop the above until such time as all the faulty lines have been ... >> Sub Craig() ...
    (microsoft.public.excel.programming)
  • Re: list comprehension
    ... But after reading it, I was left with a question. ... at first I tried rearranging the one of the examples from the previously referenced document to clarify what was going on: ... then when I tried to rewrite it as a nested for loop, that's when I realized list comprehensions is a method of returning the calculation in the interior of a for loop as an assignment without requiring aggregation of results in a temporary variable. ... I would even settle for a wizard tool generating the first approximation for me. ...
    (comp.lang.python)