<image onabort='eventHandler()'> - Javascript DOM Event

Javascript examples for DOM Event:onabort

Introduction

The onabort event occurs when the user aborts the loading of an <img> or <input type="image"> element.

Summary

Bubbles Yes
Cancelable No
Supported HTML tags: <img> and <input type="image">

Execute a JavaScript if loading of an image is aborted:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<image src='http://java2s.com/resources/a.png' onabort="myFunction()"/>

<script>
function myFunction() {/*from ww w  . j ava2  s .  c om*/
    console.log("abort");
}
</script>

</body>
</html>

Related Tutorials