You are on page 1of 2

Rollover –html:

<html>

<head>

<title> Show image rollover with mouse event . </title>

</head>

<body>

<h2> Show image rollover with mouse event. </h2>

<h4> Rollover on the below image to change the image. </h4>

<img src="https://www.tutorialspoint.com/python_pillow/images/tutorials_point.jpg"
style="height:100px;width:100px;"

id="demo" name="demo" alt="demo Image">

<script>

let deomImage = document.getElementById("demo");

deomImage.addEventListener( "mouseover", function () {

document.demo.src = "https://www.tutorialspoint.com/static/images/logo-footer-b.png";

});

deomImage.addEventListener( "mouseout", function () {

document.demo.src = "https://www.tutorialspoint.com/python_pillow/images/tutorials_point.jpg"

});

</script>

</body>

</html>

Output:

You might also like