Javascript examples for DOM HTML Element:Input Color
Style Form Input Fields With Background Color Style
<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) {// w w w.ja v a 2 s . c om document.getElementById(x).style.background = "red"; } function demoFocusout(x) { document.getElementById(x).style.background = "blue"; } </script> </body> </html>