Click to return to the DHTML, HTML     
childNodes Collection     controlRange Collection     DHTML Collections    
Web Workshop  |  DHTML, HTML & CSS

children Collection


Retrieves a collection of elements that are direct descendants of the object.

Syntax

[ collChildren = ] object.children
[ oObject = ] object.children(vIndex [, iSubIndex])

Possible Values

collChildren Array containing the direct descendants of an object.
oObject Reference to an individual item in the array of elements contained by the object.
vIndexRequired. Integer or string that specifies the element or collection to retrieve. If this parameter is an integer, the method returns the element in the collection at the given position, where the first element has value 0, the second has 1, and so on. If this parameter is a string and there is more than one element with the name or id property equal to the string, the method returns a collection of matching elements.
iSubIndexOptional. Position of an element to retrieve. This parameter is used when vIndex is a string. The method uses the string to construct a collection of all elements that have a name or id property equal to the string, and then retrieves from this collection the element at the position specified by iSubIndex.

Members

Remarks

Similar to the objects contained in the all collection, the objects contained in the children collection are undefined if the child elements are overlapping tags.

The children collection can contain HTML elements.

Example

This example shows how to determine the collections for two DIV elements, divONE and divTWO. The children collection for divONE includes IMG, DIV, and BUTTON. The children collection for divTWO includes P.

<DIV id=divONE>
<IMG src=mygif.gif>
<DIV id=divTWO>
<P>Some text in a paragraph
</DIV>
<BUTTON> The label for the button </BUTTON>
</DIV>

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, custom, DD, DEL, DFN, DIR, DIV, DL, document, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, Hn, HR, HTML, I, IFRAME, IMG, INS, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, NEXTID, OL, OPTION, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, THEAD, TITLE, TR, TT, U, UL, VAR, XMP


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.