
In this JavaScript tutorial we will learn how to create an alert popup box when user / visitor mouse over (hover) over a div region.
JavaScript Code
Let's create a JavaScript function that will create an alert popup message box.
function boxHover() {
alert("You have mouse over the box");
}
HTML
Now we will create a div region and call the above function on mouse over (hover).
<div id="box" onmouseover="boxHover()"></div>
CSS
Let's give some length and width to our div region.
#box {
width: 100%;
height: 300px;
background: yellow;
}
Done!!
Category