Image onabortEvent

Image 对象参考手册Image Object

Definition and Usage

The onabort event occurs when the loading of an image is interrupted.

Syntax

onabort="JavaScriptCode"

Parameters Description
JavaScriptCode Required. Specifies the JavaScript to execute when the event occurs.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onabort event.


Examples

In this example, if the loading of the image is interrupted, a dialog box will be displayed:

<html>
<meta charset="utf-8">
<title>Example(example.com)</title>
<script>
function abortImage()
{
    alert('Error: 图像加载终止!')
}
</script>
</head>

<body>
<img src="image_w3default.gif.html" onabort="abortImage()">
</body>

</html>


Image 对象参考手册Image Object Other Extensions