This article describes the usage of the document object images collection in the DOM of html. Share it for your reference. The specific analysis is as follows:
The images collection returns a reference to all Image objects in the document.
grammar:
Copy the code as follows: document.images[]
For compatibility with level 0 DOM, this collection does not include images defined by the <object> tag.
example:
Copy the code as follows: <html>
<body>
<img src="hackanm.gif">
<br />
<img src="compman.gif">
<br /><br />
<script type="text/javascript">
document.write("This document contains: ")
document.write(document.images.length + " images.")
</script>
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.