JavaScript Reference/Javascript Collections/scripts — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

"scripts" Example

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



"scripts" is applied to

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



"scripts" JavaScript properties and JavaScript methods

JavaScript properties and JavaScript methods
 
item(), length, namedItem(), tags(), urns()



"scripts" Syntax Parameters and Note

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.