Sometimes, it can be inconvenient to walk the document hierarchy to locate an object by its NAME. One alternative is to search the all[] collection but this is a linear search that takes place serially through the document object collection from beginning to end. It can take quite a while to locate the object.
There may also be some conflict in locating objects. The ID and NAME attributes are different and yet often the two namespaces are combined and searched together.
This method is a faster way of locating object specifically by its NAME value and ignoring its ID value. It searches the only unmerged namespace for the NAME value.
Prev | Home | Next |
Document.getElementById() | Up | Document.getElementsByTagName() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |