<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title><script src="http://cdn.bootcss.com/jquery/2.1.0-beta3/jquery.min.js"></script></head><body><img id="img" src="clock60.png" retry="0" ><script>$(function() { $('#img').on('error', function() { var retry= $('#img').attr("retry"); if (retry > 0) { $('#img').attr('src', 'https://iustudio.science/images/srpr/logo11w.png'); } else { retry++; $('#img').attr("retry", retry); $('#img').attr('src', $('#img').attr('src')); } });}) </script></body></html>
详细解决方案
图片加载失败时,重试加载,如其重试加载不出来则显示默认图片
热度:221 发布时间:2016-04-24 02:49:28.0
相关解决方案