在画面上我有两个radio(一组):
<input name="name" type="radio" value="2" onclick="period()"/> 苹果
<input name="name" type="radio" value="1" checked onclick="noPeriod()"/> 橘子还有text框:
<input type="text" id="id" name="dDate" />我现在想 点value是”2“的radio,text框可用,点value是”1“的radio,text框不可用js代码:function period() {
document.getElementById("id").disabled=true;
}function noPeriod() {
document.getElementById("id").disabled=false;
}为什么我点完了 画面没有反应,是不是没有进行画面刷新啊??
那位大哥会请指教一下。最好有个例子什么的。小弟在此先谢谢

解决方案 »

  1.   

    要是 隐藏的话  function noPeriod() { //document.getElementById("id").disabled=false;
    document.getElementById("id").style.display = "none";
    }
      

  2.   

    代码木有问题,只不过跟你描述的情况相反了,点苹果不可用,点橘子可用,调用函数互换下。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    function period() {
        document.getElementById("id").disabled = true;
    }function noPeriod() {
        document.getElementById("id").disabled = false;
    }
    </script>
    </head><body>
    <input name="name" type="radio" value="2" onclick="noPeriod()"/> 苹果
    <input name="name" type="radio" value="1" checked onclick="period()"/> 橘子
    <input type="text" id="id" name="dDate" />
    </body>
    </html>
      

  3.   

    document.getElementById("id").disabled="disabled";
    document.getElementById("id").disabled="";
      

  4.   

    楼主  两个redio用一个方法
    function checkRaido(o)
    {
       if(o.value ==1)
    {
    document.getElementById("id").disabled="disabled";}
    else
    {
    document.getElementById("id").disabled="";}
    }
      

  5.   

    disabled=true; 表示不可用。