There are a lot of ways to set the contents of input boxes, and here are two simpler and more practical methods.
Method One:
<input type= "text" value= "search" onfocus= "this.value=" "onblur=" if (this.value== ') {this.value= ' search '} '/>
Method Two: <input type= "text" placeholder= "search"/> Some browsers do not support
Of course, can also write JS to achieve, here is not an example. Because both of these methods can achieve the basic hint effect.
Set input input box disabled the following are also listed in three ways.
Method One:
disable= "Disable" or add the Disable property directly to set it.
Sex: <input type= "text" name= "lname" disabled= "Disabled" placeholder= "was set disabled"/>
Sex: <input type= "text" name= "lname" Disabled placeholder= "was set disabled"/> Effect
Method Two:
The ReadOnly property can also achieve the above effect, for disable is different when the former is read-only state
Method Three:
Let the mouse not get focus
<input type= "text" value= "is set to disable" onfocus= "This.blur ()" >
The Autofocus property can be used to set the input input box to automatically get focus.
<input type= "text" placeholder= "Automatically get Focus" autofocus>