HTML中Text设为不可编辑,不可用

时间:2015-01-15 01:52:27   收藏:0   阅读:225

1.readonly = "true"

<input type="text"  readonly = "true"/>

 

2.disabled = "true"

<input type="text"  disabled = "true"/>


3.当focus触发时,立刻blur,使它无法获得焦点。

<input type="text" onfocus="this.blur()"  readonly="true"/>


readonly/disabled都可以不跟参数,默认都是不可编辑;disabled="true"文本不可提交,readonly="true"可被提交。


本文出自 “Shows technology” 博客,请务必保留此出处http://wangzhijun.blog.51cto.com/9660708/1604078

原文:http://wangzhijun.blog.51cto.com/9660708/1604078

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!