在javascript函数中,当用户点击按钮1时,文本框可以填写,
当点击按钮2时,文本框不可填写,要在函数中填写,请问怎么实现?

解决方案 »

  1.   

    function btn1_Onclick()
    {
      txtUGrpType.readOnly=false;
    }function btn2_Onclick()
    {
      txtUGrpType.readOnly=true;
    }
      

  2.   

    <input name=txtUGrpType type=text class="EditBox2" style="width:120px;" maxlength=128></TD></TR>
    <script for="txtUGrpType" event="onkeydown">
    this.blur();
    </script>
    onKeydown的K请小写~~
      

  3.   

    不准用户填写,可以使用disabled属性啊
    <input type="text" name="t1" disabled>
    <input type="button" onclick="t1.disabled=false;this.value='可以填写了'" value="点击才能填写">
      

  4.   

    <input type="text" name="t1">
    <input type="button" value="按钮1" onclick="t1.disabled=false">
    <input type="button" value="按钮2" onclick="t1.disabled=true">
      

  5.   

    <input type="text" name="t1">
    <input type="button" value="按钮1" onclick="t1.readOnly=false">
    <input type="button" value="按钮2" onclick="t1.readOnly=true">
    为什么要用onKeyDown啊??没有看到你的要求必须用到啊