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