本想让每道题的选择信息分别显示在各自括号内的文本框中,可结果却是全部显示在第一题的文本框里。怎么改呢?不懂js,网上拼凑的代码。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>一</title>
<script language="Javascript">
function btnClick(v){document.all.MyText.value=v.value;}
var MyText=[];
for(var i=1;i<=3;i++){
MyText[i]="MyText"+i;
}
//alert(MyText);
//function btnClick(textId,v){ document.getElementById("textId").value=v.value;}
</script>
</head>
<body>
<form><p>1(<input type="text" id="MyText" value=" " style="border:0px none;; text-align:center" size="11")
<input type="radio" id="a11" name="radiobutton" value="错" onClick="btnClick(this)">A
<input type="radio" id="a12" name="radiobutton" value="B" onClick="btnClick(this)">B
<input type="radio" id="a13" name="radiobutton" value="错" onClick="btnClick(this)">C
<input type="radio" id="a14" name="radiobutton" value="错" onClick="btnClick(this)">D
<p>2(<input type="text" id="MyText1" value=" " style="border:0px none;; text-align:center" size="11">)
<input type="radio" id="a21" name="radiobutton" value="错" onClick="btnClick(this)" >A
<input type="radio" id="a22" name="radiobutton" value="B" onClick="btnClick(this)" >B
<input type="radio" id="a23" name="radiobutton" value="错" onClick="btnClick(this)" >C
<input type="radio" id="a24" name="radiobutton" value="错" onClick="btnClick(this)" >D
<p>3(<input type="text" id="MyText2" value=" " style="border:0px none;; text-align:center" size="11">)
<input type="radio" id="a31" name="radiobutton" value="错" onClick="btnClick(this)" >A
<input type="radio" id="a32" name="radiobutton" value="错" onClick="btnClick(this)" >B
<input type="radio" id="a33" name="radiobutton" value="C" onClick="btnClick(this)">C
<input type="radio" id="a34" name="radiobutton" value="错" onClick="btnClick(this)" >D</p>
</form>
</body>
</html>
java
document.all
JavaScript
MyText