Javascript examples for DOM Event:onfocusout
Using "onfocusout" together with the "onfocusin" event:
<!DOCTYPE html> <html> <body> Enter your name: <input type="text" id="myInput" onfocusin="focusFunction()" onfocusout="blurFunction()"> <script> function focusFunction() {// w w w .ja v a 2 s . c om document.getElementById("myInput").style.background = "yellow"; } function blurFunction() { document.getElementById("myInput").style.background = "red"; } </script> </body> </html>