You must have seen the Internet when the load failed red Fork picture, specific as. Of course, Google Chrome and Firefox will look good in their processing now.
You can actually take advantage of the onerror event of the picture tag to handle it, requiring it to load a default picture immediately after it fails, instead of displaying it as a red fork.
The code is as follows:
Meaning, if loading s.png this picture fails, immediately to load xx.png this picture, simultaneously xx.png this picture requests it to load in 80x80 way.
Of course, if you want to set more properties, you can write it exactly like this:
The JavaScript handler function that declares that the s.png fails to load is onerrorhandle, and then passes itself, that is, the IMG node,
Then write one of these onerrorhandle functions in javascript:
function Onerrorhandle (obj) {obj.src= "xx.png"; obj.width=80;obj.height=80;}
In this case, you can set more properties on this onerrorhandle function and use the Obj.xx property on it. At the same time avoid the onerror= "" in the double quotation marks of the event to write too many single quotes, to stun themselves embarrassed.
"JavaScript" Loading failed Red Cross image processing with picture label OnError Event