Home > Web Front-end > JS Tutorial > The onerror event was not found when parsing the img image. Stack overflow at line: 0_javascript skills

The onerror event was not found when parsing the img image. Stack overflow at line: 0_javascript skills

WBOY
Release: 2016-05-16 17:07:48
Original
942 people have browsed it

When opening the web page, it prompts Stack overflow at line: 0. I made a screenshot as follows:

After analysis, it was found that there is code similar to the following in the webpage:

pic

Analysis: Pay special attention to onerror. When the picture does not exist, onerror will be triggered, and onerror specifies a NoPic.gif picture for img. That is to say, pic.gif will be displayed if the picture exists, and noPic.gif will be displayed if the picture does not exist. But here comes the problem. If noPic.gif does not exist, onerror will continue to be triggered, causing a loop, so an error occurs.

Note: If the image exists but the network is not smooth, onerror may also be triggered.

Solution: First method: Remove the onerror code; or change the onerror code to something else; or ensure that the image in onerror is small enough and exists.

Second type:


${file. name } 

Third method:
Use two



Related labels:
img
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template