我想在文本框里显出单选按扭的值,怎么做呀

tianqwwq 2004-08-06 12:40:38
我的代码是这样的
<tr>
<td background="image/bk.gif" class="unnamed1"><div align="center">请输入你认为本届奥运会男子100M冠军成绩:
<input name="cheng2" type="text" class="tx" id="cheng2" size="5" value="">
<font color="#FF0000">秒</font> </div></td>
</tr>
<tr>
<td background="image/bk.gif"><div align="center"> <span class="unnamed1">
<input name="cheng1" type="radio" value="9.78" >
<font color="0099FF">9.78 </font> 
<input type="radio" name="cheng1" value="9.81" >
<font color="0099FF">9.81</font>  
<input name="cheng1" type="radio" value="9.83" checked >
<font color="#0099FF">9.83</font></span></div></td>
</tr>
我想在文本框里显出单选按扭的值,怎么做呀
...全文
47 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
ecobin 2004-08-06
<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="image/bk.gif" class="unnamed1"><div align="center">请输入你认为本届奥运会男子100M冠军成绩:
<input name="cheng2" type="text" class="tx" id="cheng2" size="5" value="9.83">
<font color="#FF0000">秒</font> </div></td>
</tr>
<tr>
<td background="image/bk.gif"><div align="center"> <span class="unnamed1">
<input name="cheng1" type="radio" value="9.78" onclick="document.all['cheng2'].value='9.78'">
<font color="0099FF">9.78 </font> 
<input type="radio" name="cheng1" value="9.81" onclick="document.all['cheng2'].value='9.81'">
<font color="0099FF">9.81</font>  
<input name="cheng1" type="radio" onclick="document.all['cheng2'].value='9.83'" value="9.83" checked="checked">
<font color="#0099FF">9.83</font></span></div></td>
</tr>
</table>
回复
xiaobird1 2004-08-06
try:
...
<input name="cheng1" type="radio" value="9.78" onclick="SetValue( this.value );">
...
<input type="radio" name="cheng1" value="9.81" onclick="SetValue( this.value );">
...
<input name="cheng1" type="radio" value="9.83" checked onclick="SetValue( this.value );">

<Script Languate="JavaScript">
function SetValue( iValue )
{
document.all.cheng2.value = iValue;
}
</Script>
回复
ecobin 2004-08-06
改进:最好是把document.all['cheng2'].value='9.81'改成 document.all['cheng2'].value=this.value



<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="image/bk.gif" class="unnamed1"><div align="center">请输入你认为本届奥运会男子100M冠军成绩:
<input name="cheng2" type="text" class="tx" id="cheng2" size="5" value="9.83">
<font color="#FF0000">秒</font> </div></td>
</tr>
<tr>
<td background="image/bk.gif"><div align="center"> <span class="unnamed1">
<input name="cheng1" type="radio" value="9.78" onclick="document.all['cheng2'].value=this.value">
<font color="0099FF">9.78 </font> 
<input type="radio" name="cheng1" value="9.81" onclick="document.all['cheng2'].value=this.value">
<font color="0099FF">9.81</font>  
<input name="cheng1" type="radio" onclick="document.all['cheng2'].value=this.value" value="9.83" checked="checked">
<font color="#0099FF">9.83</font></span></div></td>
</tr>
</table>
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-06 12:40
社区公告
暂无公告