Friday, December 28, 2012

ondblclick

Event handler ondblclick (Bubbles: Yes, Cancelable: Yes) terjadi ketika adanya proses dua kali onclick. Event handler ini valid untuk hampir semua elemen.

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

<BUTTON ONDBLCLICK="alert('Halo saya event handler')">Klik dua kali tombol ini</BUTTON>

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

<BUTTON ID="buttonID">Klik dua kali disini</BUTTON> <SCRIPT TYPE="text/javascript"> function HandleEvent() { alert('Halo saya event handler!'); } document.getElementById("buttonID").ondblclick=HandleEvent; </SCRIPT>

Berikut contoh meregister event handler ondblclick via DOM:

<BUTTON ID="buttonID">Klik dua kali tombol ini</BUTTON> <SCRIPT TYPE="text/javascript"> function HandleEvent() { alert("Halo saya event handler!"); } var buttonElem=document.getElementById("buttonID"); buttonElem.addEventListener("dblclick", HandleEvent, false); </SCRIPT>