JavaScript Reference/Javascript Methods/tags

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

"tags()" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript">

   function function1() {
       alert(document.all.tags("p").length);
   }

</script>

This is a sample text.

This is another sample text.

This is another sample text.

This is another sample text.

<input type="button" value="Number of p elements" onClick="function1();"> </body> </html>


     </source>
   
  


"tags()" is applied to

   <source lang="javascript">

Names noted with an asterisk (*) are JavaScript properties only. +----------------+--------------------------------------------------------------+ | Applied_To |all* anchors* | | |applets* areas* | | |boundElements* cells* | | |children* elements* | | |embeds* forms* | | |images* links* | | |options* plugins* | | |rows* scripts* | | |tBodies* | +----------------+--------------------------------------------------------------+

     </source>
   
  


"tags()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Returns a list of tag name. Returns null if no match is found.

Syntax:

collectionName.tags(param1) Parameters:

   param1   Required; the tag"s name.
   
     
     </source>