[Javascript] how to refer to (x)html elements

Hassan Schroeder hassan at webtuitive.com
Thu Nov 13 12:39:11 CST 2003


David Lovering wrote:

> The use of ID is again employed (as I suggested) as a CSS2 standard.  I
> believe the w3 standards group is the same one that backed the HTML standard
> (and by extension the JavaScript usage of the id header).  I don't believe
> they are in the practice of promoting nonsense, although I could be
> mistaken.

I've no idea what that has to do with an ID being unique within
a document. As the page you referenced says,

   "The ID attribute of a document language allows authors to
    assign an identifier to one element instance in the document
    tree."

Nowhere does it suggest that there's a "CSS ID" that's different
from "an HTML ID" or "a JavaScript ID"...

> Now for the peace offering -- I AGREE with you; the only meaningful role for
> "id" is as a one-to-one and onto identification for DOM objects.  The pity
> is that the CSS folks didn't pick something other than "ID" as the handle to
> hang all this other stuff off of. 

what "other stuff"?? An "id" represents a unique object within the
document. It's irrelevant whether you want to style that object or
move it or add event handlers to it. Whatever you want to do with
it, the "id" gives you a handle.

Why the heck would anyone want to have to address the same object
two different ways?

-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.






More information about the Javascript mailing list