html和jsp页面中把文本框禁用,只能读不能写的方法

Posted 鳄鱼菌

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html和jsp页面中把文本框禁用,只能读不能写的方法相关的知识,希望对你有一定的参考价值。

方法常用有三种:

 

第一种,使用   onfocus="this.blur()"

1 <input name="deptno" type="text" class="dfinput" value="${requestScope.dept.deptno}"  onfocus="this.blur()"/>

 

第二种,使用   disabled=“disabled”

1 <input name="deptno" type="text" class="dfinput" value="${requestScope.dept.deptno}"  disabled="disabled"/>

 

第三种,使用  readonly=“true

1 <input name="deptno" type="text" class="dfinput" value="${requestScope.dept.deptno}"  readonly="true"/>

 

 

水平有限,如果还有其它的方式,请评论留言。

 

以上是关于html和jsp页面中把文本框禁用,只能读不能写的方法的主要内容,如果未能解决你的问题,请参考以下文章