how to get img src value without img id? (with javascript)

ababababa<img src="http://example.com/blabla/bego.png">ababababa

getElementsByTagName() would give you a list of nodes.

That's not an error, it's a list.

Once you have the items in the collection, you can access the items. Here is an example that should get you going...

<body>

<img src="images/image1.jpg" />
<img src="images/image2.jpg" />

<script>
    var images = document.getElementsByTagName("img"); 
    for (var i = 0; i < images.length; i++) { 
        var source = images[i].getAttribute("src"); 
        console.log(source)
        }

</script>

</body>

The output in the JavaScript console would be...

images/image1.jpg
images/image2.jpg

got it now, getElementsByTagName(), mr. JorgeM you are right. thank you. thread close.