asked 5 years ago viewed 45028 times active 3 years ago Upcoming Events 2016 Community Moderator Election ends in 9 days Linked 0 Why doesn't getElementsByTagName work in this logic? -4 it is not working still if there is a body tag. silly behaviour of IE ... share|improve this answer edited Aug 6 '11 at 14:08 Matt♦ 50.2k1093141 answered Aug 6 '11 at 14:03 Digital Plane 19.4k33450 Only one so Im guessing position 0 in array, http://stackoverflow.com/questions/6967297/getelementsbyname-not-working
But the code in your answer uses the .item() method, which is not an array method. I'm trying execute this code but it's failing.
Secondly you shouldn't initialise your arr variable to a new array because you then immediately overwrite that with the value returned by .getElementsByName() (it doesn't put the result into your array, Getelementsbyname Value What is the difference between two condition evaluation approaches in bash Isn't the BBC being extremely irresponsible in describing how to authenticate an account-related email? Sep 13 '07 #4 reply P: 3 kurzweil4 hi ... Continued Tip: You can use the length property of the NodeList object to determine the number of elements with the specified name, then you can loop through all elements and extract the
How do I make an alien technology feel alien? If you like my tutorials, consider make a donation to these charities.Popular PostsLoading...Comments ← Older Comments →Pingback: Vanda()Pingback: anan?z? a good translation of "We can do it"? Document.getelementsbyname Set Value Big difference. –Pacerier Mar 1 '15 at 19:36 add a comment| up vote 3 down vote Just had a similar issue, I resolved it with a simple loop over the array.
This same type of problemshave been repeating a lot over the last month. You can access the value of the first item like this: document.getElementsByName("to").item(0).value Or like this: document.getElementsByName("to").value More info: https://developer.mozilla.org/en/DOM/HTMLCollection share|improve this answer answered Jan 13 '12 at 4:24 Wayne Burkett 41.8k89398 all designate name attributes. Are people taking classes using 10 year old text books??
Example HTML code 1: This example illustrates the use of the getElementsByName method: