search
Homephp教程php手册php锁定文本框内容的方法

php锁定文本框内容的方法

Jun 06, 2016 pm 07:55 PM
linuxphpcontenttextmethodCommunityEnterlocking

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 有时候我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如input type="text" name="zg" value="中国" 的内容,"中国"两个字不可以修改,有三种方法。 方法1: onfocus=this.blur() inpu

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

  有时候我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如 的内容,"中国"两个字不可以修改,有三种方法。

  方法1: onfocus=this.blur()

  

  方法2:readonly

  

  

  方法3: disabled

  

  下面分别是readonly和disabled的效果截图:

php锁定文本框内容的方法

  ****************************************************************************************

  应用案例:

php锁定文本框内容的方法

  [html] view plaincopy

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

登录密码: * 当前的登录密码
真实姓名:

  

* 请输入您的真实姓名
身份证号:

  

* 请输入您的身份证号

  

  从数据库中读出姓名,当姓名修改提交后,把数据库中的ustat字段设置为1,刷新页面后,当检测到son[ustat]==1时,添加属性readonly,防止用户再次修改文本框内容。

php锁定文本框内容的方法

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.