document.getELementById(textId).disabled=true;
document.getELementById(textId).readOnly=true;

解决方案 »

  1.   

    不好意思
    getELementById(textId)是什么意思?
      

  2.   

    可不可以用
    document.forms[0].elements[1].readOnly=true;
      

  3.   

    getElementById()是根据name或id取得页面内的元素,要只读的话,把readonly属性赋为true即可
      

  4.   

    我是想在点击了按钮后才让text的属性为只读的。
    而且用的是struts的<html:text>标签
      

  5.   

    <input type=button onclick="document.getELementById('textId').readOnly=true">