Sometimes, we want the text boxes in the form to be read-only so that users cannot modify the information in them, such as making the content of <input type="text" name="input1" value="中国">, the word "中国" cannot be modified. To summarize, there are several ways to implement it. Method 1: onfocus=this.blur() will lose focus when the mouse cannot be placed <input type="text" name="input1" value="中国" onfocus=this.blur()> Method 2: readonly <input type="text" name="input1" value="中国" readonly> <input type="text" name="input1" value="中国" readonly="true"> Method 3: disabled <input type="text" name="input1" value="中国" 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" If this option is enabled, the text will become gray and cannot be edited. readOnly="true" text will not change color and is not editable CSS shielding input: <input style="ime-mode: disabled"> There are two methods: First: disabled="disabled". After this definition, the disabled input element is neither available nor clickable. Second: readonly="readonly" read-only fields cannot be modified. However, users can still use the tab key to switch to the field, and can select or copy its text; |
<<: TortoiseSvn Little Turtle Installation Latest Detailed Graphics Tutorial
>>: Design Theory: Hierarchy in Design
The worst option is to sort the results by time a...
I recently encountered a strange thing when debug...
tomcat server configuration When everyone is lear...
CSS style: Copy code The code is as follows: <s...
background I have a project service that uses AWS...
I. Introduction Docker technology is very popular...
I saw this question in the SQL training question ...
mysql accidentally deleted data Using the delete ...
Many friends will report the following error when...
Table of contents Create a new user Authorize new...
We better start paying attention, because HTML Po...
This article shares the specific code of js to re...
React Native is a cross-platform mobile applicati...
Preface: Sometimes, the session connected to MySQ...
Preface: I recently started to study the construc...