有时候,我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如使<input type="text" name="input1" value="中国"> 的内容,"中国"两个字不可以修改。实现的方式归纳一下,有如下几种。

方法1: onfocus=this.blur()

<input type="text" name="input1" value="中国" onfocus=this.blur()>

方法2:readonly

<input type="text" name="input1" value="中国" readonly>

<input type="text" name="input1" value="中国" readonly="true">

方法3: disabled

<input type="text" name="input1" value="中国" disabled>

最新文章

  1. LeetCode之461. Hamming Distance
  2. iOS App更改显示的项目名
  3. linux centos service 参数详解
  4. BookRent借阅管理
  5. OS开发拓展篇—应用之间的跳转和数据传
  6. ubuntu配置服务器环境
  7. shell脚本-获取时间
  8. 关于mysql 连接数
  9. oracle——分析函数——排序值分析函数
  10. VC6.0的工程设置解读Project--Settings
  11. nginx+lua安装配置
  12. C++ Primer 5 CH6 函数
  13. Java 原始数据类型
  14. SDP(13): Scala.Future - far from completion,绝不能用来做甩手掌柜
  15. Qzone React Native改造
  16. C#中添加log4net(日志文件)
  17. JS自学笔记05
  18. Windows 8创新之路——样章分享
  19. 跟我一起学习ASP.NET 4.5 MVC4.0(六)
  20. 二分查找(等于x,小于x,小于等于x,大于x,大于等于x )

热门文章

  1. Redis集群(三):主从配置一
  2. Filter(过滤器)学习
  3. windows下使用vs进行Proctocol Buffer开发(C++篇)
  4. 构建自己的 Linux 发行版
  5. 软件打包为exe NSIS单文件封包工具V2.3
  6. c# cache 缓存
  7. Map工具系列-06-销售营改增历史数据处理工具
  8. 用java下载hdfs文件报NullPointerException
  9. android 手机去哪儿7.2版本客户端 账号存储信息分析
  10. TypeScript Generics(泛型)