BDT
04-08-2003, 05:41 AM
I am trying to use document.images[] to compare images to see if they are the same as follows:
for (i=1;i<=3;i++) {
if(document.images[0].src==document.images[i])
This isn't working and when I test it with:
alert("Image[0]= " + document.images[0].src + " and image " + i + " = " + document.images[i])
the test returns the proper image file name for what ever is on the left side of the conditional expression (==), but won't return the file of the image to the right. It just says that it is an [object].
I suppose that I could use some string functions like:
IMG= document.images[0].src;
IMGi= document.images[i].src;
(IMG.substring(0) if(IMG!=IMGi)
But I'm thinkin' there's a better way. Any suggestions??
thanks, BDT
for (i=1;i<=3;i++) {
if(document.images[0].src==document.images[i])
This isn't working and when I test it with:
alert("Image[0]= " + document.images[0].src + " and image " + i + " = " + document.images[i])
the test returns the proper image file name for what ever is on the left side of the conditional expression (==), but won't return the file of the image to the right. It just says that it is an [object].
I suppose that I could use some string functions like:
IMG= document.images[0].src;
IMGi= document.images[i].src;
(IMG.substring(0) if(IMG!=IMGi)
But I'm thinkin' there's a better way. Any suggestions??
thanks, BDT