无标题文档
人多不足以依赖,要生存只有靠自己。
      深窥自己的心,而后发觉一切的奇迹在你自己。
          凡事皆有终结,因此,耐心是赢得成功的一种手段。

让表单文本框只读不可编辑的方法

 

 

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

 

View Code
方法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>

 

很简单,但有时候很有用!

posted @ 2012-09-10 17:19  酷玩时刻  阅读(227)  评论(0编辑  收藏  举报
友情链接:快递查询 快递查询