Click on the cell to clear the default value and be able to set the input font color:
In many cases, the text box has default text, which is usually the text of the prompt class, when you click on the text box to clear the writing text, the following is a brief introduction to how to achieve this effect. The code is as follows:
<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"> <title>JavaScript convenience Form</title><Scripttype= "Text/javascript">functionTxtfocus (EL) {if(El.defaultvalue==el.value) {El.value= "'; El.style.color= 'Red'; }}functionTxtblur (EL) {if(El.value== "') {El.value=El.defaultvalue; El.style.color= '#000'; }}</Script><Body><inputtype= "text"style= "color: #666;"onfocus= "Txtfocus (this)"onblur= "Txtblur (this)"value= ' Please enter a predetermined person '></Body></HTML>
The above code implements the function we want, when you click on the text box to clear the default value of the text box, the input text will also change color. The code is very simple and is not covered here.
The original address is: http://www.51texiao.cn/javascriptjiaocheng/2015/0507/901.html
The original address is: http://www.softwhy.com/
Click on the cell to clear the default value and be able to set the input font color