오류 이벤트는 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>