当前位置: 代码迷 >> ASP.NET >> 在页面上,Radio 改变时,怎么在 text里显示Radio对应的选中值
  详细解决方案

在页面上,Radio 改变时,怎么在 text里显示Radio对应的选中值

热度:2985   发布时间:2013-02-25 00:00:00.0
在页面上,Radio 改变时,如何在 text里显示Radio对应的选中值?
在页面上,Radio         改变时,如何在     text里显示Radio对应的选中值?    


Radio和text都是非服务器控件,    
 
 
代码如下:    
<table     width= "100% "     border= "0 "     cellspacing= "1 "     cellpadding= "1 ">    
<tr>    
<td> <INPUT   id= "Answer1 "type= "radio "   value= "A "    
name= "Answer1 ">     A. </td>    
</tr>    
<tr>    
<td> <INPUT   id= "Answer1 "   type= "radio "   value= "B "    
name= "Answer1 "> B. </td>    
</tr>    
<tr>    
<td> <INPUT   id= "Answer1 "   type= "radio "   value= "C "    
name= "Answer1 ">    
C. </td>    
</tr>    
<tr>    
<td> <INPUT   id= "Answer1 "   type= "radio "   value= "D "    
name= "Answer1 "> D.     <input   type= "text "   name= "FText "> </td>    
</tr>    
</table>

------解决方案--------------------------------------------------------
循环判断Answer1的每个项的选中情况,然后处理。
------解决方案--------------------------------------------------------
http://ghd258.cnblogs.com/archive/2005/11/07/270758
------解决方案--------------------------------------------------------
JS可以实现的呀
------解决方案--------------------------------------------------------
<html>
<body>
<table width= "100% " border= "0 " cellspacing= "1 " cellpadding= "1 ">
<tr>
<td> <INPUT id= "Answer1 "type= "radio " value= "A "
name= "Answer1 " onclick= "change() "> A. </td>
</tr>
<tr>
<td> <INPUT id= "Answer1 " type= "radio " value= "B "
name= "Answer1 " onclick= "change() "> B. </td>
</tr>
<tr>
<td> <INPUT id= "Answer1 " type= "radio " value= "C "
name= "Answer1 " onclick= "change() ">
C. </td>
</tr>
<tr>
<td> <INPUT id= "Answer1 " type= "radio " value= "D "
name= "Answer1 " onclick= "change() "> D.

<input type= "text " name= "FText " id= "FText "> </td>
</tr>
</table>
</body>
</html>
<script>
function change()
{
for(i=0;i <document.all.Answer1.length;i++)
{
if(document.all.Answer1[i].checked){document.all.FText.value=document.all.Answer1[i].value}
}
}

</script>
------解决方案--------------------------------------------------------
<html>
<head>
<title> ffffffffffffff </title>
<script language= "javascript " type= "text/javascript ">
  相关解决方案