JavaScript Reference/Javascript Properties/canHaveChildren
"canHaveChildren" Example
<source lang="javascript">
<html> <head> <script language="JavaScript">
function function1() { for (var i = 0; i < document.all.length; i++) { if (document.all[i].canHaveChildren) { document.all[i].style.color = "blue"; } } alert("Colored elements can have children!"); }
</script> </head> <body> <input type="button"
value="Color in blue only the elements that can have children" onClick="function1();">
<input type="checkbox" checked> The checkbox label <input type="text" name="text1" value="Some textbox here.">
Header 1 | Header 2 | Header 3 |
---|---|---|
Cell 1 | Cell 2 | Cell 3 |
Cell 4 | Cell 5 | Cell 6 |
p
</body> </html>
</source>
"canHaveChildren" is applied to
<source lang="javascript">
+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> | | | |
| |<body> || |<button>
| | | | | |
| |<dir><col> | | |<colgroup> <comment> | | |<custom>
| | | || | |
- | | | <fieldset> | | | <form> | | |<frameset> <head> | | |<hn> <html> | | | <iframe> | | |<input type="button"> <input type="checkbox"> | | |<input type="file"> <input type="image"> | | |<input type="password"> <input type="radio"> | | |<input type="reset"> <input type="submit"> | | |<input type="text"> | | | <label> | | |<legend>
- | | |<listing> <map> | | |<marquee> <menu> | | |<object>
| | |<option>
| | |<plaintext>
| | || | | <select> | | | | | || | | | | |<tbody> | | |
<textarea> | | |<tfoot> | | |<thead> | | | | | | | | |<xmp> | +----------------+--------------------------------------------------------------+ </source>
"canHaveChildren" Syntax and Note
<source lang="javascript"> Note: Read-only property. Indicates whether or not the element can have children.
Syntax:
document.all.elementID.canHaveChildren
</source>