为什么它会给出错误的域?有没有更好的解决方案
var domainlerimtek=["bock.com","sok.com","www.google.co.uk","coaskkdak.com"];
for(var i=0;i<domainlerimtek.length;i++)
{
var im = new Image();
im.src = document.location.protocol+"//"+domainlerimtek[i]+"/images/srpr/logo3w.png";
im.onload = function(){alert(im.src);};
}
或者
var domainlerimtek=["bock.com","sok.com","www.google.co.uk","coaskkdak.com"];
for(var i=0;i<domainlerimtek.length;i++)
{
var im = new Image();var geci=i;
im.src = document.location.protocol+"//"+domainlerimtek[i]+"/images/srpr/logo3w.png";
im.onerror = function(){alert(geci);};
}