²»Í¬ä¯ÀÀÆ÷´¦Àí´íÎóͼƬÊDz»Ò»ÑùµÄ£¬Óеĸɴà¾ÍÏÔʾ²îºÅ£¬ÀýÈçIE£¬ÓеÄÏÔʾһÕÅÆÆËéµÄͼƬ£¬ÓеÄÔòÊǸøÒ»ÕŸ߶ȱȽϴóµÄĬÈÏͼ£¬ÀýÈçPC¶ËµÄ»ðºü£¬IOSÖÐSafari,»¹Óа²×¿ÖеÄUCä¯ÀÀÆ÷¡£ÕâÑùÔÚÊÖ»úÖоͻᵼÖÂ×óÓÒÁ½²àͼƬ¸ß¶È²»Ò»Ö£¡ÈçÏÂͼ£º
½â¾ö·½°¸
ÆäʵÕâÀï½â¾öºÜ¼òµ¥£¬Åжϵ±Í¼Æ¬¼ÓÔØʧ°ÜµÄʱºò¸øÒ»¸öĬÈÏͼ¾Í¿ÉÒÔÁË£¬²»ÈÃä¯ÀÀÆ÷ʹÓÃÆä×Ô´øµÄĬÈÏͼ¡£
<img src="http://www.aseoe.com/images/logo.png" onerror="javascript£ºthis.src='http://www.aseoe.com/images/logo.png';" alt="pic" />
ÑÜÉúÎÊÌâ
ÒòΪͼƬ¼ÓÔØʧ°Ü½øÈëĬÈÏͼ£¬ÄÇôĬÈÏͼÔÙ¼ÓÔØʧ°ÜÔõô°ìÄØ£¿Õâ²»ÊǽøÈëÒ»¸öËÀÑ»·Âð£¿
×î¼òµ¥µÄÒ»¸ö½â¾ö°ì·¨ÊÇ£¬onerrorÖеÄͼ±£Ö¤ÄÜ´ò¿ª£¬±£Ö¤±È½ÏС£¡²»»á³öÏÖÎÊÌ⣡¡£Õâ¸ö·½·¨Ò²ÊÇ×îÓÐЧµÄ·½·¨£¡
¼ÙÈçÄã²»Äܱ£Ö¤£¬ÄÇô£¬Ö»ÄÜ¿¿º¯ÊýÀ´½â¾öÕâ¸öÎÊÌâÁË£¡
˼·ÊÇ£º
µ±Í¼Æ¬¼ÓÔØʧ°Ü£¬½øÈëonerrorµÄʱºò£¬ÅжÏonerrorµÄͼƬÊDz»ÊÇÄܼÓÔØ£¬ÔÚonerrorÖеÄͼƬ´¥·¢onerrorµÄʱºò£¬ÉèÖÃonerrorΪnull¡£
´úÂëÈçÏ£º
<img src="logo.png" onerror="nofind();" /> <script type="text/javascript"> function nofind(){ var img=event.srcElement || event.target ; //»ñÈ¡img¶ÔÏ󣬻ðºüÊÇevent.target £¬IE¼°¹È¸èÆäËûÊÇevent.srcElement console.dir(img);//´ó¼Ò¿ÉÒÔ´òÓ¡¿´Ò»Ï img.src="http://www.aseoe.com/statics/images/nopic.gif"; img.onerror=null; } </script>
±¾Õ¾»¶ÓÈκÎÐÎʽµÄתÔØ£¬µ«ÇëÎñ±Ø×¢Ã÷³ö´¦£¬×ðÖØËûÈËÀͶ¯³É¹û
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-692-1.html
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-692-1.html