Checking images within html

Asked 2 years ago, Updated 2 years ago, 46 views

I am making chm file using HTml. However, images are often broken because they are not properly applied in html files.

You want to create a tool that can check broken images when the image in the html file looks broken by x. (For Check)

Is it possible? If possible, what code would be a hint?

html java image

2022-09-22 16:54

1 Answers

I was wondering if you could use the onerror attribute.

<img src="image.png" onerror="imgError(this);"/>
function imgError(image) {
    image.onerror = "";
    image.src = "/images/noimage.gif";
    return true;
}


2022-09-22 16:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.