Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
jumpOnCommand #1
JavaScript For Loops
I think this is the correct forum;
I'm used to using ActionScript, and I think thats where Im making my mistakes
when scripting with Javascript.
This is a simplified script of what I need. myNumber3 should output 10, yet
nothing comes back. Can you see what I'm missing?
for( x=0; x<5; x++){
var myNumber[x]=10;
alert (myNumber3);
}
Thanks
jumpOnCommand
jumpOnCommand Guest
-
Nested loops?
Hi, I've been adapting a script which parses HTML and creates an RSS feed (http://www.perl.com/lpt/a/2001/11/15/creatingrss.html). Now I want... -
For While Loops
Hello, Please, can anyone tell me what is the equivalent in CMFL. Thanks Graham Brown -
SQL OR CF loops?
I'm hoping someone that actually knows what they are doing can assist me. I have a CFLOOP that simply spits out the contents of a table. Problem... -
Using 'my' within nested loops
I am curious about the amount of overhead created with the first example below as compared to the second example below: Example 1: my $this;... -
[PHP] nested for loops
your syntax is correct, just need to change for ($j=0: $j < 5; $j++) to for ($j=0; $j < 5; $j++) Anyone ever do a nested for loop? $i =0; $j... -
robhuddles #2
Re: JavaScript For Loops
You never create a myNumber3 variable. Your syntax for creating the variable -
myNumber[x] - is going to generate an array, with each element of the array set
to 10. You could then have alert(myNumber[3]); however, the script will error
out on the first loop, as the fourth element of the array (myNumber[3]) won't
yet exist. Taking the alert out of the loop should work.
robhuddles Guest
-
T.Pastrana - 4Level #3
Re: JavaScript For Loops
You have to declare your variables and ( almost always ) initiate your
arrays.
function num(){
var myNumber = [];
for( var x=0; x<5; x++){
myNumber[x]=10;
}
alert (myNumber[3]);
}
--
Regards,
...Trent Pastrana
[url]www.fourlevel.com[/url]
"jumpOnCommand" <dchapman_4@btopenworld.com> wrote in message
news:ei50rl$325$1@forums.macromedia.com...>I think this is the correct forum;
>
> I'm used to using ActionScript, and I think thats where Im making my
> mistakes
> when scripting with Javascript.
>
> This is a simplified script of what I need. myNumber3 should output 10,
> yet
> nothing comes back. Can you see what I'm missing?
>
> for( x=0; x<5; x++){
> var myNumber[x]=10;
> alert (myNumber3);
> }
>
> Thanks
>
> jumpOnCommand
>
T.Pastrana - 4Level Guest



Reply With Quote

