Home > Web Front-end > HTML Tutorial > Onabort is an event that occurs when image loading is interrupted in HTML.

Onabort is an event that occurs when image loading is interrupted in HTML.

黄舟
Release: 2017-11-07 10:51:44
Original
2082 people have browsed it

Definition and Usage

onabort Event Occurs when image loading is interrupted.

This handler is called when the user gives up loading the image before it has finished loading (such as clicking the stop button).

Syntax

onabort="SomeJavaScriptCode"
Copy after login
ParametersDescription
SomeJavaScriptCode Required. Specifies the JavaScript to be executed when this event occurs.

HTML tag that supports this event:

<img>
Copy after login

JavaScript that supports this event Object:

image
Copy after login

Instance 1

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

<img src="image_w3default.gif"onabort="alert(&#39;Error: Loading of the image was aborted&#39;)" />
Copy after login

Example 2

In this example, if the loading of the image Interrupt, we will call a function:

<html>
<head>
<script type="text/javascript">
function abortImage()
{
alert(&#39;Error: Loading of the image was aborted&#39;)
}
</script>
</head>

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

</html>
Copy after login


The above is the detailed content of Onabort is an event that occurs when image loading is interrupted in HTML.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template