The moose likes HTML, CSS and JavaScript and the fly likes getElementsByName Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "getElementsByName" Watch "getElementsByName" New topic
Author

getElementsByName

cyril vidal
Ranch Hand

Joined: Jul 02, 2003
Posts: 247
Hi,
I'm under Internet 5.5 and I would like to retrieve the first div element of a list, whose name is "dir".

Why the second alert of my script results in undefined although it seemms a collection object is built (first alert returns an object).
So my question is: how do I retrieve an item of the collection returned by the document.getElementsByName method?
Thanks for your help,
Regards
Cyril.


SCJP 1.4, SCWCD, SCBCD, IBM XML, IBM Websphere 285, IBM Websphere 287
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
See if this helps you out
http://www.mozilla.org/docs/dom/domref/dom_doc_ref49.html
The item() part is waht you want to look at.
Eric
 
 
subject: getElementsByName
 
Threads others viewed
jQuery not working on page
jquery - ajax call to another site and parse result
Unable to get the "children" of an element
DOJO Grid and JSON
IE doesn't seem to reflect updated document object
IntelliJ Java IDE