Home > Web Front-end > HTML Tutorial > How to make text boxes such as form input read-only and non-editable in HTML_HTML/Xhtml_Web page production

How to make text boxes such as form input read-only and non-editable in HTML_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:41:00
Original
2015 people have browsed it

Sometimes, we want the text box in the form to be read-only so that the user cannot modify the information in it. For example, in the content of , the word "China" cannot be modified. To summarize, the implementation methods are as follows.

Method 1: onfocus=this.blur() Leave focus when the mouse cannot be placed


Method 2: readonly



Method 3: disabled


Full example:



disabled="true " The text will turn gray and cannot be edited.
readOnly="true" The text will not change color and is not editable

css shielding input:

There are two The first method: disabled="disabled" is defined so that 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 select or copy its text;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template