高分:通过复选框控制文本框的状态

来源:百度知道 编辑:UC知道 时间:2024/07/04 10:25:56
用复选框来控制文本框能否输入的状态,我做的是一个成绩录入,就是从数据库中调出student信息,然后输入成绩,插入到学生成绩表中
,还需要一个全选控制,谢谢,如果不清楚我可给你代码,回答好的话再加分,谢谢

<script language="javascript">
function setText(){
if(form1.check.checked==true) form1.testText.disabled=false;
else form1.testText.disabled=true;
}
function CheckAll(form){
for(i_c=0;i_c<form.elements.length;i_c++){
e=form.elements[i_c];
if(e.Name!="chkAll"){
e.checked=form.chkAll.checked;
}
}
}
</script>
<form name="form1">
<input type="checkbox" name="check" onClick="setText()"><input type="text" name="testText" disabled><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input name="chkAll" type="checkbox" o