请教如何监听
写了个测试函数如下,还是需要刷新一次浏览器才能看到width,
function checkImg(theURL)
{
var img1= new Image();
img1.src = theURL;
if (img1.complete) document.write(img1.width);
else setTimeout(checkImg(' + theURL + '), 100) ;
}
【 在 hgoldfish 的大作中提到: 】
: 呵呵。。这就是我前两天问的那个问题。
: 通过监听onload搞定了。不过已经在缓存中的图片没有onload,需要判断是一个img.complete。
:
--
FROM 202.127.200.*