JavaScript Reference/Javascript Collections/children
Содержание
"children" Example
<html>
<head>
<script language="JavaScript">
function function1() {
var m = document.all.myBody.children;
for (i=0; i<m.length; i++)
alert(m.item(i).tagName);
}
</script>
</head>
<body id="myBody">
<input id=myB
type="button"
value="Direct descendants of this body element"
onclick="function1();">
</body>
</html>
"children" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<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> |
| |<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> <ol> |
| |<option> <p> |
| |<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> |
+----------------+--------------------------------------------------------------+
"children" JavaScript properties and JavaScript methods
JavaScript properties and JavaScript methods
item(), length, tags(), urns()
"children" Syntax Parameters and Note
Note:
Returns an array of all first-generation elements of the element.
Syntax:
document.all.elementID.children // returns all child elements
document.all.elementID.children(param1, param2) // returns an individual child
element
param1 Required; zero-based index or
desired member"s id or name attribute.
param2 Optional; the zero-based index for the result returned
if param1 matches more than one element.