javascript中如何动态设置文本框的只读性
如何动态设置文本框的只读属性? 
 比如在form里有一个下拉框和文本框,当下拉框的值变化时,动态的设置文本框的只读性?在javascript的函数中使用      document.formname.textname.readonly   =    " ";没有用. 
 那位高手帮忙解决一下?? 
------解决方案-------------------- <%@ page language= "java " import= "java.util.* " pageEncoding= "GBK "%>  
  <html>  
 	 <head>  
 		 <title>  </title>  
 		 <script type= "text/javascript ">  
 		 function change(s) 
 		 { 
 		   document.getElementById( "t ").value=s; 
 		 } 
 		 </script>  
 	 </head>  
 	 <body>    
 		 <FORM METHOD= "POST " ACTION= " ">  
 			 <INPUT TYPE= "text " id= "t " readonly= "readonly ">  
 			 <select	onchange= "change(this.value); ">  
 				 <OPTION VALUE= "aaa " SELECTED> aaa </OPTION>  
 				 <OPTION VALUE= "bbb "> bbb </OPTION>  
 			 </SELECT>  
 		 </FORM>   		 
 	 </body>  
  </html>  
------解决方案-------------------- <html xmlns= "http://www.w3.org/1999/xhtml ">  
  <head>  
  <meta http-equiv= "Content-Type " content= "text/html; charset=shift_jis " />  
  <title> 无标题文档 </title>  
 	 <script language= "javascript ">  
 		function setText(obj) 
 		{ 
 			var valsel = obj.value; 
 			var textid = document.getElementById( "textfield "); 
 			if(valsel ==  "1 ") 
 			 textid.disabled = true; 
 			else 
 			   textid.disabled = false;  			 
 		} 
 	 </script>  
  </head>    
  <body>  
  <form name= "form1 " id= "form1 " method= "post " action= " ">  
    <input type= "text " name= "textfield " />  
    <select name= "select " size= "1 " onchange= "setText(this); ">  
      <option value= "1 "> Yes </option>  
      <option value= "2 "> NO </option>  
    </select>  
  </form>  
  </body>  
  </html>
------解决方案--------------------document.formname.textname.readOnly = true;