Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,895 questions

51,826 answers

573 users

How to get the document images collection from the current HTML document in JavaScript

1 Answer

0 votes
<!DOCTYPE html>        
<html>
<head>
<title</title>
</head>
<body>

<img src="aaa.gif"> 
<img src="bbb.jpg"> 
<img src="ccc.png"> 
<script type="text/JavaScript">   


document.write(document.images + "<br />");

var img_list = document.images;

for(var i = 0; i < img_list.length; i++) 
    document.write(img_list[i].src + "<br />");


/*
run:

[object HTMLCollection]
http://localhost:8080/aaa.gif
http://localhost:8080/bbb.jpg
http://localhost:8080/ccc.png

*/

</script>
</body>
</html>

 



answered Jun 10, 2016 by avibootz
...