开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜