Prev Demo
JavaScript
>
How To Execute A Function When User Moves The Mouse Out From The Element In Javascript?
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Onmouseout</h1> Enter your name: <input type="text" name="txtName" id="txtName" /> <input type="button" id="btn" name="btn" value="Submit" onmouseout="ClearColor(this.id)" onmouseover="CallFunction(this.id)" /> <script> function CallFunction(id) { document.getElementById(id).style.background = "#c0c0c0"; } function ClearColor(id) { document.getElementById(id).style.background = ""; } </script> <p><strong>Note:</strong> Place and remove the cursor on the button to find the difference.</p> </body> </html>
Note: We DO NOT save your trial code in our database.
Output