JavaScript Reference/Javascript Collections/scripts

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

"scripts" Example

   <source lang="javascript">
   

<html> <body> <button onclick="getTotal();">Get total script tags</button> <script language="JavaScript">

   function getTotal() {
       var m = document.scripts.length; 
       alert(m);
   }

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


     </source>
   
  


"scripts" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |document | +----------------+--------------------------------------------------------------+

     </source>
   
  


"scripts" JavaScript properties and JavaScript methods

   <source lang="javascript">

JavaScript properties and JavaScript methods

item(), length, namedItem(), tags(), urns()


     </source>
   
  


"scripts" Syntax Parameters and Note

   <source lang="javascript">

Note: Returns an array of all <script> elements in a document.

Syntax:

document.scripts // returns all scripts document.scripts(param1, param2) // returns an individual script Parameters:

   param1   Required; zero-based index 
                      desired member"s id or name attribute.
                      
   param2   Optional; the zero-based index for the result returned
                      if param1 matches more than one element.
   
     
     </source>