Sometimes, we hope that the text box in the form is read-only, so that the user cannot modify the information in it. For example, the content of <input type=text name=input1 value=China> cannot be modified. To summarize the implementation methods, there are several types.
Method 1: onfocus=this.blur() If the mouse cannot be placed, leave the focus
<input type=text name=input1 value=China onfocus=this.blur()>
Method 2: readonly
<input type=text name=input1 value=China readonly>
<input type=text name=input1 value=China readonly=true>
Method 3: disabled
<input type=text name=input1 value=China disabled=true>
Complete example:
<input name=ly_qq type=text tabindex=2 onMouseOver=this.className='input_1' onMouseOut=this.className='input_2' value=123456789 disabled=true readOnly=true />
disabled=true The text of this fruit will turn gray and cannot be edited.
readOnly=true Text will not change color and cannot be edited.
css mask input: <input style=ime-mode: disabled>
There are two methods: first: disabled=disabled The input element that is disabled after definition is neither available nor clickable. Second: readonly=readonly The readonly field cannot be modified. However, users can still use the tab key to switch to this field, and can also select or copy its text;