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

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

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

"images" Example

    
<html>
<body>
<img src="image1.jpg" width="100" height="100">
<img src="image2.jpg" width="100" height="100"> 
<img src="image3.jpg" width="100" height="100"> 
<img src="image1.jpg" width="100" height="100">
<img src="image2.jpg" width="100" height="100"> 
<img src="image3.jpg" width="100" height="100"> 
<button onclick="alert(document.images.length);">
Number of images in the document
</button>
</body>
</html>



"images" is applied to

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



"images" JavaScript properties and JavaScript methods

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



"images" Syntax Parameters and Note

Note:
Returns an array of all <img> elements in the document.
    
Syntax:
    
document.images // returns all images
document.images(param1, param2) // returns an individual image

    param1   Required; zero-based index or 
                       the value of the desired member"s id or name attribute.

    param2   Optional; zero-based index for the result returned
                       if param1 matches more than one element.