87,921
社区成员
发帖
与我相关
我的任务
分享
<script >
function abc() {
var obj = document.getElementById("form1").getElementsByTagName("input");
for(var i=0;i<obj.length;i++){
if(obj[i].type == "radio" && obj[i].checked){
document.getElementById("txtID").value=obj[i].value;
return true;
}
}
}
</script>
<script >
function abc() {
var obj = document.getElementsByName("rd_id");
for(var i=0;i<obj.length;i++){
if(obj[i].checked){
document.getElementById("txtID").value=obj[i].value;
return true;
}
}
}
</script>
</head>
<body>
<form id="form1" name="form1" action="" method="get">
<input type="radio" name="rd_id" value="1" onchange="abc();" /><br />
<input type="radio" name="rd_id" value="2" onchange="abc();" /><br />
<input type="radio" name="rd_id" value="3" onchange="abc();" /><br />
<input type="radio" name="rd_id" value="4" onchange="abc();" /><br />
</form>
<form id="form2" name="form2" method="post" action="">
<input name="txtID" id="txtID" type="text" />
</form>
</body>