JavaScript DHTML/Node Operation/canHaveChildren

Материал из Web эксперт
Перейти к: навигация, поиск

"canHaveChildren" Example

   <source lang="html4strict">
   

<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("Elements have not been colored!");
   }

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

</body> </html>


     </source>