Handle input mouse in and mouse out event - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Handle input mouse in and mouse out event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <input type="text" id="demoInput" onfocus="demoFocus(this.id)" onfocusout="demoFocusout(this.id)"> 
      <script>
function demoFocus(x) {//from  w  w  w.java  2  s.co m
    document.getElementById(x).style.background = "red";
}
function demoFocusout(x) {
    document.getElementById(x).style.background = "blue";
}

      </script>  
   </body>
</html>

Related Tutorials