Latest

recent

JavaScript - onabort Event

Definition and Usage

The onabort event occurs when loading of an image is aborted.

Syntax

onabort="SomeJavaScriptCode"

Parameter Description
SomeJavaScriptCode Required. Specifies a JavaScript to be executed when the event occurs.

Supported by the following HTML tags:

<img>

Supported by the following JavaScript objects:

image


Example 1

In this example an alert box will be displayed if the loading of the image is aborted:

<img src="image.gif"
onabort="alert('Error: Loading of the image was aborted')">


Example 2

In this example we will call a function  if the loading of the image is aborted:

<html>
<head>
<script type="text/javascript">
function abortImage()
{
alert('Error: Loading of the image was aborted');
}
</script>
</head>
<body>
<img src="image.gif"
onabort="abortImage()">
</body>
</html>
JavaScript - onabort Event Reviewed by 1000sourcecodes on 06:14 Rating: 5
Powered by Blogger.