关于表单的问题
请问如何判断radio按钮是否被选中?
我下面的代码对吗?如果不对的话请帮助我指出那里错了
谢谢了?
我是想把选中的按钮的value值显示在text里面
<script>
function showRadio()
{
if(x.a.checked==true)
{
text.value=x.a.value;
}
}
</script>
<form name="x" >
<input type="radio" value="喜欢" name="a">喜欢
<br>
<input type="radio" value="不喜欢" name="a" >不喜欢
<br>
<input type="text" name="text" >
<br>
<input type="button" name="c" value="确定" onclick="showRadio()">
</form>