javascript - Dynamicly select object using number from variable -
i'm wondering, if it's possible :
i have new object:
// create new object form existing code var v1 = $("#div1").getmyobject();
now can use v1 object, example:
v1.start();
now question is: have variable, example: var num = 1;
now want find way select v1 object, using num variable (this of course not work, want show, need):
v+num.start()
so see, want use var num, , assign var object name, later use.
i'm asking, because, need select proper object in loop, , want select dynamicly.
thank advice.
instead of having objects like:
v1, v2, ....
you should have:
v[1], v[1], ....
then can use
v[1] = $("#div1").getmyobject(); v[num].start();
Comments
Post a Comment