Get alt/src tag (image) from webpage to AS list

Simple example showing how to extract alt/src tag ‘Image’ from html webpage.

To something more useful for AppleScripters.

set theCount to count getDocumentImages()
set theResultList to {}
repeat with i from 1 to (theCount / 2)
	set theList to getDocumentImages()
	set {theAlt, theSrc} to {item i of theList, item (i + 1) of theList}
	copy {theAlt, theSrc} to end of the theResultList
end repeat
return theResultList

on getDocumentImages()
	set theScript to "function myFunc() {
	var arr = [], images = document.images;
	for (var i=0;i<images.length;i++){
	arr.push(images[i].alt) + arr.push(images[i].src);
	}
	return arr
	}
	myFunc()
	"
	tell application "Safari" to do JavaScript theScript in document 1
end getDocumentImages