471,873 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Dynamic Variable ?

Hi all,

hopefully someone knows the answer to this one !

Im trying to use something like this...
>var riders = dropriders.split(",");

for (x in riders)
{
var shebang = strvalue.concat("rider" , riders[x]);
value += rPrice[document.myteam.shebang.value];
}
dropriders can be from one to ten elements looking something like --1,2,6

Therefore in the value += line, i would want shebang to be replaced by
rider1, rider2, rider6.

Any thoughts ?

Thanks in advance,

Leon
May 10 '07 #1
2 1276
On May 11, 8:10 am, Leon <l...@dontcallmeeeore.co.ukwrote:
Hi all,

hopefully someone knows the answer to this one !
The FAQ does...

Im trying to use something like this...
>var riders = dropriders.split(",");
>>
>for (x in riders)
>{
>var shebang = strvalue.concat("rider" , riders[x]);
>value += rPrice[document.myteam.shebang.value];
>}

dropriders can be from one to ten elements looking something like --1,2,6

Therefore in the value += line, i would want shebang to be replaced by
rider1, rider2, rider6.

Any thoughts ?
<URL: http://www.jibbering.com/faq/#FAQ4_39 >
--
Rob

May 10 '07 #2
In comp.lang.javascript message <4643986b$0$8711$ed2619ec@ptn-nntp-
reader02.plus.net>, Thu, 10 May 2007 23:10:51, Leon
<le**@dontcallmeeeore.co.ukposted:
>>var shebang = strvalue.concat("rider" , riders[x]);
value += rPrice[document.myteam.shebang.value];
>Therefore in the value += line, i would want shebang to be replaced by
rider1, rider2, rider6.
FAQ 4.25 provides the necessary clue. FAQ 4.39 is better. They should
be merged, or at least consecutive.

The example in 4.39, while valid, is pointless; there should also be an
example with a variable string, such as "Item"+N. I can see no point in
using bracket notation where the string is a constant known at code-
writing time.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
May 11 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by fivelitermustang | last post: by
1 post views Thread by Nathan Bloomfield | last post: by
2 posts views Thread by Martin Hart - Memory Soft, S.L. | last post: by
2 posts views Thread by deejayquai | last post: by
2 posts views Thread by Luis Arvayo | last post: by
14 posts views Thread by vivek | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.