HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 6th, 2004, 05:39 PM
Laoujin Laoujin is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 15 Laoujin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
JS: Loop through TextBoxes

Hey everyone,

There was a similiar question answered on the forum, but I couldn't quite use it for what I need done.

I have some textboxes: shire1, shire2, shire3, ...
And I want to create a string of their values:

for (i = 1; i <= amount; i++)
{
SendTo = 'shire' + i;
alert(document.frm.SendTo.value);
SendToString += '; ' + document.frm.SendTo.value;
}

I thought I used similar code before but for some reason it is saying "Sendto.value" is not an object.

What am I doing wrong?

Thanks!

Reply With Quote
  #2  
Old April 8th, 2004, 06:35 AM
Yeruhn's Avatar
Yeruhn Yeruhn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Netherlands
Posts: 428 Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 16 h 35 m 27 sec
Reputation Power: 10
SendTo is a string, not the object you want.
Use eval('document.frm.shire' + i + '.value')
or better have a look at getElementById()

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > JS: Loop through TextBoxes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT