1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title></title> 6 <script src="jquery-1.7.1.js"></script> 7 <script type="text/javascript"> 8 $(document).ready(function () { 9 $("img").attr("onerror", "showErroImg(this,2);"); 10 }); 11 function showErroImg(imgObj, maxErrorNum) { 12 if (maxErrorNum > 0) { 13 imgObj.onerror = function () { 14 showErroImg(imgObj, maxErrorNum - 1); 15 }; 16 setTimeout(function () { 17 imgObj.src = "bg_fn_blog.png"; 18 }, 500); 19 } else { 20 imgObj.onerror = null; 21 imgObj.src = ""; 22 } 23 } 24 25 </script> 26 </head> 27 <body> 28 <img src="sweiku.com.jpge" /> 29 <img src="sweiku.com.jpge" /> 30 <img src="sweiku.com.jpge" /> 31 <img src="sweiku.com.jpge" /> 32 <img src="sweiku.com.jpge" /> 33 <img src="sweiku.com.jpge" /> 34 </body> 35 </html>