Named access to elements

Hello everybody,

I am trying to understandand how the DOM provides named access to
elements, at least HTML elements but why not to core elements too.

The IDL for  HTMLElement specifies an 'id' attribute, which I assumes
has the same semantics as the HTML 4.0 ID attribute. For the IMG element
specifies a 'name' attribute for compatibility reasons.

I see the images() methods to get a NamedNodeList which I assumes allows
to find an IMG element by its 'name' attribute or by its 'id'
attribute... The same goes for applets, links, forms and anchors.

However since all elements have an ID in HTML 4.0 I expect to be able to
access any element by its document wide ID (DIV elements for instance).
How do I do that ?

I would like to explain to developpers how the code they used to write
for the various browsers should be written with the DOM. Since there has
never been a NAME attribute on IMG in standard HTML I would like to
emphasize the use of ID and point out its advantage or uniform semantics
for all elements. This does not really make sense without a named access
to all elements.

Thanks for your help,

Antoine Bertier
antoine.bertier@axa.com

Received on Tuesday, 30 June 1998 09:19:24 UTC