当一组单选按钮中的一个选中,后文本框为只读属性
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<form name="form1" id="form1">
<input type="radio" name="college">
<input type="radio" name="college">
<input type="radio" name="college">
<input type="radio" name="college">
<input type="radio" name="college">
<input name="txtCollege">
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
var obj=document.getElementById("form1");
var target="college";
for(var i=0;i<obj.elements.length;i++)
{
if (obj.elements[i].name==target)
obj.elements[i].onclick=function(){obj.elements["txtCollege"].readOnly=true;}
}
//-->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<form name="form1" id="form1">
<input type="radio" name="college">
<input type="radio" name="college">
<input type="radio" name="college">
<input type="radio" name="college">
<input type="radio" name="college">
<input name="txtCollege">
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
var obj=document.getElementById("form1");
var target="college";
for(var i=0;i<obj.elements.length;i++)
{
if (obj.elements[i].name==target)
obj.elements[i].onclick=function(){obj.elements["txtCollege"].readOnly=true;}
}
//-->
</SCRIPT>
</BODY>
</HTML>