Home  >  Article  >  Web Front-end  >  Onerror usage in img tag_javascript skills

Onerror usage in img tag_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:48:161380browse

Today I saw a TX who wrote the following code in HTML
Hey! It's ok on FF but not on IE, because there are many factors that cause onerror in the B/S structure. Here, when an onerror occurs, re-address the current picture
However, this will cause network reasons or If the image cannot be loaded normally for other reasons, onerror will be called again. A browser based on Microsoft's core set will think that this is an infinite loop
and will report a stack overflow error.
Solution:
Use two

Copy the code The code is as follows:




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn