Friday, December 28, 2012

onmousemove

Event handler onmousemove (Bubbles: Yes, Cancelable: No) terjadi ketika mouse digerakkan di atas area elemen. Event handler ini valid untuk hampir semua elemen.

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

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

Berikut contoh meregister event handler onmousemove 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").onmousemove=HandleEvent; </SCRIPT>

Berikut contoh meregister event handler onmousemove 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("mousemove", HandleEvent, false); </SCRIPT>