The id PropertyAs you can guess, the id property corresponds to the ID HTML attribute, and holds an object's ID value. Working with ID values is relatively new for browsers, coming in largely because the W3C DOM emphasizes the ID attribute over the NAME attribute. You can see the support for these properties in Table 5.26. Table 5.26. The id Property
Here's an example extending the code in the document object topic earlier in this chapter; in this case, I'll report an object's ID when displaying a warning in the object's document: function warner(object1) { if(object1.isBad()){ object1.document.write("WARNING: Bad Object Found! ID:" object1.id) } } |