HTML onmouseout Attribute

HTML onmouseout Attribute: The HTML onmouseout attribute is defined as it fires when the mouse pointer moves out of an element. And the onmouseout attribute is often used together with the onmouseover attribute.

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

HTML onmouseout Attribute

This attribute can be applied to all the HTML elements.

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

Syntax: <element onmouseout=”script”>

Browser Support:

This attribute is supported by the following browsers:

  • Chrome
  • Safari
  • Opera
  • Internet Explorer
  • Firefox

Example: for <img> element

<!DOCTYPE html>  
<html>  
    <head>  
        <title> 
            onmouseout Event Attribute 
        </title>  
        <script>  
          
            /* Script run when onmouseout  
                     event call */ 
            function freshers() {  
                alert("Mouse move out");  
            }  
        </script>  
    </head>  
      
    <body style = "text-align:center">  
      
        <h2> 
            onmouseout Event Attribute 
        </h2>  
          
        <!-- onmouseout event call here -->
        <p onmouseout = "freshers()"> 
            Computer science portal 
        </p>  
    </body>  
</html>

Output:

HTML onmouseout attribute