jquery图片无法加载的问题
有谁知道如何检查图像是否正确加载。我有一个预加载图像的脚本,我想做的是如果图像不存在,这会导致我的脚本无法结束,我只需将属性“src”设置为默认值
image.load(function(){
//it never reache here if the image doesn't exist
}).attr('src','a non existing image');
谢谢
does anybody knows how to check if an image loads properly. I have a script that preloads images and what I wanted to do is if the image doesn't exists, which causes my script not to end, I would just make the attribute "src" to be a default value
image.load(function(){
//it never reache here if the image doesn't exist
}).attr('src','a non existing image');
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)