C# RadioButtonList的鼠标双击事件
我有一个RadioButton列表,其中有几个列表项。当用户在认为他们选择了一个选项之前点击,即使他们在这里不需要它 是否可以用鼠标双击列表,将RadioButtonList的SelectedIndex设置为-1C# RadioButtonList的鼠标双击事件,c#,asp.net,radiobuttonlist,C#,Asp.net,Radiobuttonlist,我有一个RadioButton列表,其中有几个列表项。当用户在认为他们选择了一个选项之前点击,即使他们在这里不需要它 是否可以用鼠标双击列表,将RadioButtonList的SelectedIndex设置为-1 asp.net c#webapplication双击以下jquery脚本时,将取消选中选中的单选按钮项 <asp:RadioButtonList ID="RadioButtonList1" runat="server"> <asp:ListItem Text=
asp.net c#webapplication双击以下jquery脚本时,将取消选中选中的单选按钮项
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Text="One" Value="1"></asp:ListItem>
<asp:ListItem Text="Two" Value="2"></asp:ListItem>
<asp:ListItem Text="Three" Value="3"></asp:ListItem>
</asp:RadioButtonList>
<script type="text/javascript" src="Scripts/jquery-1.4.2-vsdoc.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#<%= RadioButtonList1.ClientID %>').dblclick(function () {
$('#<%= RadioButtonList1.ClientID %> input:radio:checked').each(function () {
$(this).attr('checked', false);
});
});
});
</script>
以下jquery脚本在双击选中的单选按钮项目时将取消选中该项目
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Text="One" Value="1"></asp:ListItem>
<asp:ListItem Text="Two" Value="2"></asp:ListItem>
<asp:ListItem Text="Three" Value="3"></asp:ListItem>
</asp:RadioButtonList>
<script type="text/javascript" src="Scripts/jquery-1.4.2-vsdoc.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#<%= RadioButtonList1.ClientID %>').dblclick(function () {
$('#<%= RadioButtonList1.ClientID %> input:radio:checked').each(function () {
$(this).attr('checked', false);
});
});
});
</script>
您是否希望用户单击单选按钮后可以撤消选择?@beased我动态创建了RBL,并在一个表单上有多个RBL。我可以组合一个下拉列表,用户可以在其中选择需要清除的rbl,但如果可以双击,这将是一种更简单的方法。@muhammad实际上我想在单击时撤消选择,这样用户就不需要执行进一步的操作。所以当您从dropdownlist中选择某个值时,那么你想让用户不再从列表中选择单选按钮吗?我刚才说,这可能是一个困惑帖子的反应。如果以另一种方式更简单,我更喜欢这种方式,比如双击RBL。您希望用户一旦单击单选按钮,就可以撤消选择吗?@困惑我动态创建RBL,并在一个表单上有多个RBL。我可以组合一个下拉列表,用户可以在其中选择需要清除的rbl,但如果可以双击,这将是一种更简单的方法。@muhammad实际上我想在单击时撤消选择,这样用户就不需要执行进一步的操作。所以当您从dropdownlist中选择某个值时,那么你想让用户不再从列表中选择单选按钮吗?我刚才说,这可能是一个困惑帖子的反应。如果以另一种方式更简单,我更喜欢这种方式,比如双击rbl