1let test = document.getElementById("test");
2
3test.addEventListener("mouseover", function( event ) {
4 alert("mouse over test!")
5 , false);
1<img onmouseover="enlargeImage(this)" border="0" src="smiley.gif" alt="Smiley" width="32" height="32">
2
3<script>
4function enlargeImage(x) {
5 x.style.height = "64px";
6 x.style.width = "64px";
7}
8</script>
1// You can use jQuery
2
3$("p").hover(function(){
4 $(this).css("background-color", "yellow");
5 }, function(){
6 $(this).css("background-color", "pink");
7});