到目前为止我得到了这个,文本的更改将出现在输入文本中。我想把它作为span / label。
<script>
function pros(frm){
//For each checkbox see if it has been checked, record the value.
for (i = 0; i < frm.box.length; i++)
if (frm.box[i].checked){
frm.text[i].value = 'Checked';
} else {
frm.text[i].value = 'Unchecked';
}
}
</script>
,HTML是
<form method="post" action="field/check.php" name="field">
<table class='zb'>
<tr><td><b>Reading</b></td><td><input type='checkbox' id='box' name='Reading' value='Reading' onchange='pros(this.form)'/></td>
<td><input type='text' class='nobord' id='text' value='Unchecked' readonly></td></tr>
<tr><td><b>Grammar</b></td>
<td><input type='checkbox' id='box' name='Grammar' value='Grammar' onchange='pros(this.form)'/></td>
<td><input type='text' class='nobord' id='text' value='Unchecked' readonly></td></tr>
<tr><td><b>Writing</b></td>
<td><input type='checkbox' id='box' name='Writing' value='Writing' onchange='pros(this.form)'/></td>
<td><input type='text' class='nobord' id='text' value='Unchecked' readonly></td></tr>
<tr><td><b>Speaking</b></td>
<td><input type='checkbox' id='box' name='Speaking' value='Speaking' onchange='pros(this.form)'/></td>
<td><input type='text' class='nobord' id='text' value='Unchecked' readonly></td></tr>
</table><br/>
<div align="center">
<input type="submit" name="Submit" value="Submit" class="cssbutton"/>
<input name="reset" type="reset" value="Reset" class="cssbutton"/>
</form>
那么,JS如何将结果放在span / label上(如果选中或取消选中)? 然后我会在标签表格关闭后将span / label放在某处。