Retrieves the string identifying the object.
Syntax
HTML <ELEMENT ID = sID ... > Scripting [ sID = ] object.id
Possible Values
sID Any alphanumeric string that begins with a letter. The underscore (_) can also be used. In Microsoft® Internet Explorer 5 and later, the property is read/write. The property has no default value.
Remarks
In versions earlier than Internet Explorer 5, the property is read-only.
The id should be unique throughout the scope of the current document. If a document contains more than one object with the same identifier, the objects are exposed as a collection that can be referenced only in ordinal position.
Example
This example sets the ID attribute and then passes it to a function to manipulate the object that the attribute is attached to.
Sample Code
<SCRIPT> function checkCols(oObject) { var iColumns = oObject.cols; alert (iColumns); } </SCRIPT> </HEAD> <BODY> <TABLE ID=oTable BORDER COLS=3 onclick="checkCols(this)"> <TR><TD>Column 1</TD><TD>Column 2</TD><TD>Column 3</TD></TR> </TABLE>
Applies To
A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, custom, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, Hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, NEXTID, NOBR, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, styleSheet, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, WBR, XML, XMP