Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] dynamic variables names


  • From: geoff at cpe1.com (Geoff Corriere)
  • Subject: [Javascript] dynamic variables names
  • Date: Tue Jun 24 10:57:52 2003

I create a variable to hold the name of the object first. Then use it 
in the array.

foo(i){
var next_element = "nt_o" + i;
document.images[next_element].src = '../_img/1_nota_0'+i+'_on.gif';
}


On Tuesday, June 24, 2003, at 10:50  AM, Marcelo Simon wrote:

> Hi list,
> ?
> It's me again, and I need some help again please.
> ?
> how can I use dynamic variables name in JS ?
> ?
> I mean, how do I evaluate the 2 parts so they work ?
> ?
> if ( i <= number ){
> ???['nt_o'+i].src = '../_img/1_nota_0'+i+'_on.gif';
> }
> ?
> thanks in advance
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 841 bytes
Desc: not available
Url : http://lists.LaTech.edu/pipermail/javascript/attachments/20030624/6c9cb8d4/attachment.bin