Home > Article > Web Front-end > Onabort is an event that occurs when image loading is interrupted in HTML.
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"
Parameters | Description |
SomeJavaScriptCode | Required. Specifies the JavaScript to be executed when this event occurs. |
HTML tag that supports this event:
<img>
JavaScript that supports this event Object:
image
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('Error: Loading of the image was aborted')" />
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('Error: Loading of the image was aborted') } </script> </head> <body> <img src="image_w3default.gif" onabort="abortImage()" /> </body> </html>
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!