<form action="" method="post" name="form1">
<input id="cancel_time" name="cancel_time" type="checkbox">
是否改截止时间
<input id="cancel_time2" name="cancel_time2" type="checkbox">
是否改截止日期时间
<input class="crystal" name="Button" onclick="javascript:submit_confirm();" type="button"
value=" 更 新 ">
</form>
<script>
function submit_confirm() {
if(document.getElementById('cancel_time').checked == true && document.getElementById('cancel_time2').checked == true){
alert("“是否改截止日期”和“是否改截止日期时间”不能同时选择!");
return false;
}
else
{
document.form1.submit();
}
}
</script>
<input id="cancel_time" name="cancel_time" type="checkbox">
是否改截止时间
<input id="cancel_time2" name="cancel_time2" type="checkbox">
是否改截止日期时间
<input class="crystal" name="Button" onclick="javascript:submit_confirm();" type="button"
value=" 更 新 ">
</form>
<script>
function submit_confirm() {
if(document.getElementById('cancel_time').checked == true && document.getElementById('cancel_time2').checked == true){
alert("“是否改截止日期”和“是否改截止日期时间”不能同时选择!");
return false;
}
else
{
document.form1.submit();
}
}
</script>
<h4>根本无需脚本!杀鸡焉用牛刀!</h4>
<input type="radio" name="modifyList" id="radOption1"><label FOR="radOption1">是否改截止时间</label>
<input type="radio" name="modifyList" id="radOption2"><label FOR="radOption2">是否改截止日期时间</label><br />
<input type="button" name="Button" value=" 更 新 " class="crystal" >
</form>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>selecte single checkbox</title>
<meta name="generator" content="editplus" />
<meta name="author" content="yixianggao" />
<meta name="keywords" content="javascript" />
<meta name="description" content="for csdn" />
</head> <body>
<form name="form1" method="post" action="aaaa.asp">
<h4>根本无需脚本!杀鸡焉用牛刀!</h4>
<input type="radio" name="modifyList" id="radOption1"><label FOR="radOption1">是否改截止时间</label>
<input type="radio" name="modifyList" id="radOption2"><label FOR="radOption2">是否改截止日期时间</label><br /><br />
<h4>用一下下牛刀!</h4>
<span id="spaModifyList">
<!-- 不要再放其他 type 的 input -->
<input type="checkbox" id="chbOption1" /><label FOR="chbOption1">是否改截止时间</label>
<input type="checkbox" id="chbOption2" /><label FOR="chbOption2">是否改截止日期时间</label>
<input type="checkbox" id="chbOption3" /><label FOR="chbOption3">再多也不怕,哈</label>
</span>
<input type="button" name="Button" value=" 更 新 " class="crystal" >
<script type="text/javascript">
<!--
var oContainer = document.getElementById("spaModifyList");
oContainer.selectedId = "";
var oOptions = oContainer.getElementsByTagName("input");for (var i=0; i<oOptions.length; i++)
{
oOptions[i].onclick = function ()
{
if (oContainer.selectedId != "")
{
var selectedOption = document.getElementById(oContainer.selectedId);
selectedOption.checked = false;
} oContainer.selectedId = this.id;
this.checked = true;
};
}
//-->
</script>
</form>
</body>
</html>
具体问题,具体分析~
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>只能选择一个check</title><script language="javascript" type="text/javascript"></script>
</head><body>
<form id="hf">
<input id="c1" type="checkbox" onclick="this.checked==true?hf.c2.disabled=true:hf.c2.disabled=false;" /><input id="c2" type="checkbox" onclick="this.checked==true?hf.c1.disabled=true:hf.c1.disabled=false;" /></form>
</body>
</html>