日期:2014-05-18  浏览次数:20777 次

怎样设置jsp的text文本框不能编辑
有哪们帮忙一下,怎样设置jsp的文本框不能编辑,只能读取其中的值啊.

------解决方案--------------------
readonly=false
------解决方案--------------------
<input type= "text " name= "username " readonly= "true ">
------解决方案--------------------
readonly即可,写上后无论设置readonly=true,还是readonly=false,都不可编辑
<input type= "text " name= "username " readonly>
------解决方案--------------------
来晚了!
------解决方案--------------------
有两种方法: <input type= "text " name= "username " readonly> 和 <input type= "text " name= "username " disabled> 都可以的.
------解决方案--------------------
ls已经给出正确答案
------解决方案--------------------
晚了!呵呵!
------解决方案--------------------
aa: <input type= "text " name= "aa " onchange= "func() ">
bb: <input type= "text " name= "bb " onchange= "func() ">
cc: <input type= "text " name= "cc " readonly>

func()函数里实现值aa+bb

------解决方案--------------------
别乱教人,只写readonly或者disabled是不符合规范的,HTML是一个XML,属性必须写成 <tagName attName= "attValue " /> 或 <tagName attName= "attValue "> </tagName>
------解决方案--------------------
<script language=javascript>
function showData(){
try{
document.getElementById( "cc ").value=parseFloat(document.getElementById( "aa ").value)+parseFloat(document.getElementById( "bb ").value);
}catch(e){
alert( "输入的数据不合法 ");
}
}
</script>

aa: <input type= "text " name= "aa " >
bb: <input type= "text " name= "bb ">
cc: <input type= "text " name= "cc " readonly> <input type= "button " value= "add " onclick= "showData(); ">

------解决方案--------------------
<input class= "xx " name= "xxx " type= "text " readonly>