修改了一下。<html>   
<head>   
                <title>   无标题页   </title>   
                <script       language="javascript">   
                    function     change(a,b,c)   
                    {   
                    var chk1=document.getElementById(a);
                    var txt1=document.getElementById(b);
                    var txt2=document.getElementById(c);
                    txt1.disabled=true;
                    if(chk1.checked){   
                                    txt2.disabled=false; 
                                    txt2.value=txt1.value;   
                                    
                    }   else{ 
txt2.value=""; 
chk1.checked=false;
                    } 
                } 
                </script>   
</head>   
<body       >   
                <table>   
                    <tr>   
                    <td>                     
                        <input type="checkbox" id="chk" onclick="change( 'chk', 'm1', 'm2')" />   
                        </td>   
                        <td>   
                        <input type="text " id= "m1" value= "haha" disabled="true"/> 
                        <input type="text " id= "m2" disabled="true" />   
                        </td>   
                    </tr>   
                  
                </table>   
</body>   
</html>

解决方案 »

  1.   

    没有<form>,所以document.forms[0].txt2.value是不行的
      

  2.   

    没看仔细,hoho
    下面这样改应该可以了
    function change(a,b,c){   
     var chk1=document.getElementById(a);
     var txt1=document.getElementById(b);
     var txt2=document.getElementById(c);
     txt1.disabled=true;
     if(chk1.checked){
      txt2.disabled=false;
      txt2.value=document.forms[0].txt1.value;
     }else{
      document.forms[0].txt2.value="";
      chk1.checked="false";
     }
    }
    不过最好加上form,这样比较好
      

  3.   

    应该尽量避免使用form, 这样一旦页面做了很大改动,JS就不能直接重用了