Friday, December 28, 2012

onabort

Event handler onabort (Bubbles: Yes, Cancelable: No) terjadi ketika pengguna membatalkan proses muat (loading) elemen IMG atau INPUT 'image'.

Berikut contoh meregister event handler onabort via 'inline model':

<IMG SRC="image.gif" ONABORT="alert('Error: Loading gambar dibatalkan!')">

Berikut contoh meregister event handler onabort via 'traditional model':

<IMG SRC="image.gif" ID="imgID"> <SCRIPT TYPE="text/javascript"> function HandleEvent() { alert("Error: Loading gambar dibatalkan!"); } document.getElementById("imgID").onabort=HandleEvent; </SCRIPT>

Berikut contoh meregister event handler onabort via DOM:

<IMG SRC="image.gif" ID="imgID"> <SCRIPT TYPE="text/javascript"> function HandleEvent() { alert("Error: Loading gambar dibatalkan!"); } var imgElem=document.getElementById("imgID"); imgElem.addEventListener("abort", HandleEvent, false); </SCRIPT>