HTML onmouseover Attribute

HTML onmouseover Attribute: The HTML onmouseover Attribute is defined as it fires when the mouse pointer moves over an element.

Supported Tags: This attribute is supported by almost all HTML elements except <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>.

HTML onmouseover Attribute

The HTML onmouseover attribute can be applied to all the HTML elements.

Attribute value: This attribute contains a single value script which works when the mouse moves over the element.

Syntax: <element onmouseover = “script”>

Browser Support:

The HTML onmouseover attribute is supported by the following browsers:

  • Chrome
  • Firefox
  • Opera
  • Safari
  • Internet Explorer

Example: for <img> element

<!DOCTYPE html> 
<html> 
     <head> 
  <title>onmouseover Event Attribute</title> 
  <style> 
     body { 
    text-align:center; 
         } 
       h1 { 
    color:green; 
    } 
  </style> 
    <script type="text/javascript" > 
          function freshers() { 
         alert("Mouse move over"); 
         } 
    </script> 
  </head> 
  <body> 
    <h1>Freshersnow</h1> 
    <h2>onmouseover Event Attribute</h2> 
    <p onmouseover ="frehsers()">Computer science portal</p> 
  </body> 
</html>

Output:

HTML onmouseover attribute