Friday, December 28, 2012

onmouseover

Event handler onmouseover (Bubbles: Yes, Cancelable: Yes) terjadi ketika pointer mouse tepat berada di dalam / di atas area elemen (tanpa klik). Event handler ini valid untuk hampir semua elemen.

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

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

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

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