javascript - How to remove the small icon in the upper left corner when the image request fails?
淡淡烟草味
淡淡烟草味 2017-06-17 09:15:59
0
4
910

How to remove the small icon in the upper left corner when the image request fails?

淡淡烟草味
淡淡烟草味

reply all(4)
黄舟

If the request fails, please assign a default picture

阿神

Give a default image. If successful, the requested image will be used. If failed, the default image will be used.

typecho

The one that cannot be removed will still exist even if the alt attribute is added. The suggestion is that when the image request fails, display a default image or a prompt image indicating that the request failed, such as:
<img src='xxx' onerror="this.src='http://i1.buimg.com /1949/8c5e2086e458c12d.png'"/>
Not much to say about the path, both absolute paths and relative paths are acceptable.

黄舟

Call the error event of the image. If loading fails, a prompt or replacement image will be given

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!