HTML implements read-only text box and cannot modify the content

HTML implements read-only text box and cannot modify the content

Without further ado, I will post the code for you directly. The specific code is as follows:

 <!--Method 1: onfocus=this.blur() When the mouse cannot be placed, it will lose focus-->
<input type="text" name="input1" value="中国" onfocus=this.blur()> 
<!-- Method 2: readonly text will not change color and is not editable -->
<input type="text" name="input1" value="中国" readonly> 
<input type="text" name="input1" value="中国" readonly="true"> 
<!-- Method 3: disabled The text will turn gray and cannot be edited. -->
<input type="text" name="input1" value="中国" disabled="true">

Summarize

The above is the editor's introduction to HTML to implement text box read-only and cannot modify the content. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  Introduction to root directory expansion under Linux system

>>:  A brief discussion on two methods of achieving semi-transparent background color in CSS

Recommend

In-depth understanding of the implementation principle of require loader

Preface We often say that node is not a new progr...

Is it true that the simpler the web design style, the better?

Original address: http://www.webdesignfromscratch...

Vue data responsiveness summary

Before talking about data responsiveness, we need...

JavaScript web page entry-level development detailed explanation

Part 3: ❤Three ways to overlook backend data rece...

Analysis of statement execution order of sql and MySQL

I encountered a problem today: Can I use the as a...

Learn javascript iterator

Table of contents Introduction What does an itera...

Can't connect to local MySQL through socket '/tmp/mysql.sock' solution

Error message: ERROR 2002: Can't connect to l...

Build a server virtual machine in VMware Workstation Pro (graphic tutorial)

The VMware Workstation Pro version I use is: 1. F...

How to change the MySQL database directory location under Linux (CentOS) system

How to change the MySQL database directory locati...

Basic structure of HTML documents (basic knowledge of making web pages)

HTML operation principle: 1. Local operation: ope...

MySQL 8.0.15 installation and configuration graphic tutorial under Win10

This article records the installation and configu...

Several ways to easily traverse object properties in JS

Table of contents 1. Self-enumerable properties 2...

jQuery to achieve sliding stairs effect

This article shares the specific code of jQuery t...