[Javascript] dynamic variables names
Chris Tifer
christ at saeweb.com
Tue Jun 24 11:10:50 CDT 2003
Do you have a dynamic variable name? I would never use a
dynamic variable to be honest with you - or at least haven't ever
found the need for one yet, but from the looks of it below, you
don't have a dynamic variable, but rather you're trying to build
a reference to an image dynamically.
To do that, use the document.images collection and
build your string when targeting a specific element in that
collection:
document.images["nt_o" + i].src = "path/to/image.gif"
That's not a dynamic variable name - just so you're aware.
Chris Tifer
http://emailajoke.com
----- Original Message -----
From: Marcelo Simon
To: * Yahoo / Javascript
Sent: Tuesday, June 24, 2003 11:50 AM
Subject: [Javascript] dynamic variables names
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 at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20030624/5452f1f7/attachment.htm>
More information about the Javascript
mailing list