JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 21st, 2004, 10:29 AM
tonycava tonycava is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 tonycava User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
javascript function returning undefined

I have the following code

<script language="javascript">
function submitAll()

{
var elements = document.getElementsByTagName("
newlimit");

for (var i = 0; i < document.forms.length - 1; i++)


{
var input = document.createElement("input");
input.type = "hidden";


alert(elements[i].value);
input.value = elements[i].value;
document.forms[i].appendChild(input);
document.getElementById("
alllimits").submit();
}
}
</script>



<form name="limits" method=POST action="global">

<input type="hidden" name="cmd" value="temp_limits">

<newlimit><input type="text" name="new_limit" size=10 value="0"><newlimit>

<input type="hidden" name="subcmd" value="amendlimit">

<input type="hidden" name="borg_num" value="<%= rs.getString("borg_num") %>">

<input type="submit" value="Amend Limit">

</form>



<input type="button" value="Submit All" onclick="submitAll()" />

<form name="alllimits" method=POST action="global">

<input type="hidden" name="cmd" value="temp_limits">

</form>



when I select the button Submit All it fires of the submitAll javascript function.

The code var elements = document.getElementsByTagName("newlimit"); is upposed to pick up all the code between the newlimit tags :



<newlimit><input type="text" name="new_limit" size=10 value="0"><newlimit>



The problem is that this code alert(elements[i].value); returns undefined.



What am I doing wrong, thanks for any help





Tony

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > javascript function returning undefined


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 2 hosted by Hostway