JS,怎么控制单选按钮

来源:百度知道 编辑:UC知道 时间:2024/05/18 21:18:18
<form id="form" name="form" method="post" action="">
<div id="main" class="dragclass" >
<div id="ChatHead">
<input id="Initialize" name="radio" type="radio" value="web" checked="true"/><span id="Initialize">网页</span>
<input id="Initialize" name="checkbox" type="checkbox" value="more" onClick="morechoice()"/><span id="Initialize">更多</span>
</div>
......
morechoice()函数应该怎么写才能实现这样的效果:单击选择checkbox以后,radio的状态为false。

function morechoice(){
document.getElementById("Initialize").checked=false;
}
而且还要修改,id="Initialize",只能有一个,除了radio其它东西的id都改成其它吧

比如:
<td align="center"><input name="checkboxid" type="checkbox" id="checkboxid" value=<%=rs("id")%> onclick="SetDisabled(this)"/>
<label for="checkboxid"></label></td>
<script>
function SetDisabled(cb) {
var input = cb.parentNode.parentNode.getElementsByTagName('input')[0];
alert(input)
input.disabled =! cb.checked;
}
</script>

function morechoice(){
document.form.radio.checked=false;
}