JavaScript DHTML/Dojo toolkit/isDescendant

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

Check descendant by id

   <source lang="html4strict">

<html>

 <head>
   <script type="text/javascript">
     var djConfig = {
       baseScriptUri : "js/dojo/"
     };
   </script>
   <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
   <script>
     function testIt() {
       alert(dojo.isDescendant("div3", "div2"));
     }
   </script>
 </head>
 <body onLoad="testIt();">
   
   
 </body>

</html>


 </source>
   
  


Check node descendant

   <source lang="html4strict">

<html>

 <head>
   <script type="text/javascript">
     var djConfig = {
       baseScriptUri : "js/dojo/"
     };
   </script>
   <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
   <script>
     function testIt() {
       alert(dojo.isDescendant(dojo.byId("div3"), dojo.byId("div1")));
     }
   </script>
 </head>
 <body onLoad="testIt();">
   
   
 </body>

</html>

 </source>