利用javascript防止CheckBoxList多选
<asp:ListItem onclick="CheckBoxList_Click(this)" Value="1">同意</asp:ListItem>
<asp:ListItem onclick="CheckBoxList_Click(this)" Value="0">不同意</asp:ListItem>
<asp:ListItem onclick="CheckBoxList_Click(this)" Value="3">其它</asp:ListItem>
function CheckBoxList_Click(sender)
{
var container = sender.parentNode;
if(container.tagName.toUpperCase() == "span") {
container = container.parentNode.parentNode;
}
var chkList = container.getElementsByTagName("input");
var senderState = sender.checked;
for(var i=0; i<chkList.length;i++) {
chkList[i].checked = false;
}
sender.checked = senderState;
}
<asp:ListItem onclick="CheckBoxList_Click(this)" Value="0">不同意</asp:ListItem>
<asp:ListItem onclick="CheckBoxList_Click(this)" Value="3">其它</asp:ListItem>
function CheckBoxList_Click(sender)
{
var container = sender.parentNode;
if(container.tagName.toUpperCase() == "span") {
container = container.parentNode.parentNode;
}
var chkList = container.getElementsByTagName("input");
var senderState = sender.checked;
for(var i=0; i<chkList.length;i++) {
chkList[i].checked = false;
}
sender.checked = senderState;
}