At times, we are required to react to the situations, when the user takes the mouse pointer onto the element or one of its children.
This is nothing but the mouseover event. We are taking the mouse pointer over the element, or one of its children. We are going to use the Onmouseover attribute here,
This thing is used with the mouse out event, which occurs when the user moves the mouse pointer out from the element.
As you can see in the above program, we are using the Onmouseover attribute for the div element. So, when the mouseover event is triggered, the mouseOver function executes. So, if you also try to have a look at the output of the above code, and take your mouse pointer over the div element, you can simply see that the background color of the div turns green.
Now, when we take the mouse pointer out from the element, still the background color of the element is green. So, here we have another event, called Mouseout, which is triggered when we take the mouse pointer out from the element. Let’s have a look at that event as well.