Home>Article>Web Front-end> How to set the text box color to change when input in javascript
In JavaScript, you can use the onfocus event to set the text box to change color when input. You only need to bind the onfocus event to the element, and then use "object.style.background="color value"". The onfocus event occurs when an object gains focus and is typically used in forms.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Dynamicly set the text box color:
主要是利用javascript中的触发事件onfocus