Friday, December 28, 2012

onmouseup

Event handler onmouseup (Bubbles: Yes, Cancelable: Yes) terjadi ketika tombol mouse dilepaskan di atas elemen, setelah sebelumnya tombol mouse tersebut diklik. Event handler ini valid untuk hampir semua elemen.

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

<A HREF="#" ONMOUSEUP="alert('Halo saya event handler')">Visit to X.com</A>

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

<A HREF="#" ID="anchorID">Visit to X.com</A> <SCRIPT TYPE="text/javascript"> function HandleEvent() { alert('Halo saya event handler!'); } document.getElementById("anchorID").onmouseup=HandleEvent; </SCRIPT>

Berikut contoh meregister event handler onmouseup via DOM:

<A HREF="#" ID="anchorID">Visit to X.com</A> <SCRIPT TYPE="text/javascript"> function HandleEvent() { alert("Halo saya event handler!"); } var anchorElem=document.getElementById("anchorID"); anchorElem.addEventListener("mouseup", HandleEvent, false); </SCRIPT>