You can easily get an array containing all img elements through document.getElementsByTagName() :
var images = document.getElementsByTagName('img'); var srcList = []; for(var i = 0; i < images.length; i++) { srcList.push(images[i].src); }
Instead of document.getElementsByTagName('img') you can also use the document.images collection.
If you use jQuery, you can also use $('img') , which gives you a jQuery object containing all img elements.
var srcList = $('img').map(function() { return this.src; }).get();
Thiefmaster
source share