开发者

Why wont my script work for alerting upon image finding?

开发者 https://www.devze.com 2023-02-11 04:56 出处:网络
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

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

精彩评论

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

关注公众号