|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > javascript function returning undefined |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|