Why wont my script work for alerting upon image finding?
Alright basically i have the code at the bottom and it works perfec开发者_如何学运维tly if i give the full image url but im trying to get it to work if i only give part of it and use a * for the other part.
var theList = ['*this.png','site.com/folder/*'];
for(i=0; i<theImages.length; i++) {
for(j=0; j<theList.length; j++) {
if(theImages[i].src==theList[j]) alert(theList[j]+' found on this page');
}
}
Please and thanks
I... didn't really think my comment would help, but since it seems it did, I guess I'll post it as an answer:
It's not working because you used == instead of something that would take the wildcard * into account.
精彩评论