The onmouseover property allows you set a script when the mouse pointer is moved onto an element. To change the background color, use the HTML DOM backgroundColor property.
Let us see an example to implement the onmouseover property and change the background color −
Example
<!DOCTYPE html> <html> <body> <h2>Heading Two</h2> <a onmouseover="document.body.style.backgroundColor ='orange'">Hover over me to change the background color.</a><br> </body> </html>
Output
Now hover over the text to change the background color of the web page −