该的onerror当HTML发生事件触发一个错误。您可以尝试运行以下代码以实现onerror事件属性-
<!DOCTYPE html>
<html>
<body>
<img src = "new.png" onerror = "display()">
<p>Alert would be visible, if the image isn't loaded correctly.</p>
<script>
function display() {
alert("Image load unsuccessful.");
}
</script>
</body>
</html>