[Javascript] how to refer to (x)html elements
Hassan Schroeder
hassan at webtuitive.com
Wed Nov 12 16:36:55 CST 2003
David Lovering wrote:
> Yes, you can have multiple uses of an id
No. Flat no. That's wrong, in both HTML 4 and XHTML 1 --
HTML 4
source: <http://www.w3.org/TR/html4/struct/global.html#adef-id>
id = name [CS]
This attribute assigns a name to an element. This name must be unique in a
document.
XHTML 1
source: <http://www.w3.org/TR/xhtml1/#normative>
4.10. The elements with 'id' and 'name' attributes
HTML 4 defined the name attribute for the elements a, applet, form, frame,
iframe, img, and map. HTML 4 also introduced the id attribute. Both of these
attributes are designed to be used as fragment identifiers.
In XML, fragment identifiers are of type ID, and there can only be a single
attribute of type ID per element. Therefore, in XHTML 1.0 the id attribute is
defined to be of type ID.
> Also, I'm not sure what the
> convention is for returning pointers to a getElementById() call when there
> are multiple objects of the same id
There is no "convention" because it's wrong. Did I mention that? :-)
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
More information about the Javascript
mailing list