Click to See Complete Forum and Search --> : Sorting array of images


jzwill
04-14-2006, 09:46 AM
I want to sort an array of images by the Image.src attribute. I assume I need to use the oprional sortby parameter in the Array.sort() method, but I am having trouble figuring out exactly how to implement this correctly. Any ideas anyone?

Thanks in advance.

Orc Scorcher
04-14-2006, 10:10 AM
Try imageArray.sort(function (img1, img2) { return img1.src.localeCompare(img2.src) })