|
-
Nov 28th, 2001, 11:08 AM
#1
Thread Starter
Addicted Member
including a variable
if i put a line of code like that :
document.forms[0].nameoftextbox.value
between the nameoftextbox and value, i want to include a variable in that line so i'll be looping
that the names nameoftextbox_1
nameoftextbox_2
nameoftextbox_3
nameoftextbox_4
nameoftextbox_5
for...x...{
alert(document.forms[0].nameoftextbox_x.value
}
is there a way
-
Nov 28th, 2001, 11:44 AM
#2
Fanatic Member
sure..
you can use:
Code:
var objTextBox;
//loop with x
objTextBox = eval('document.forms[0].nameoftextbox_' + x);
alert(objTextBox.value);
//until x=whatever
Blade
-
Nov 28th, 2001, 11:55 AM
#3
Thread Starter
Addicted Member
Thank you very much
EVAL....that was the thing
you've been a great help
-
Nov 28th, 2001, 12:00 PM
#4
Frenzied Member
Okay, I think we should start ignoring cross posters.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|