ID Attribute | id Property

MS Office DHTML, HTML & CSS

ID Attribute | id Property


Retrieves the string identifying the object.

Syntax

HTML<ELEMENT ID = sID ... >
Scripting[ sID = ] object.id

Possible Values

sIDAny 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>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
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

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.