如何查找是否已选中复选框 [英] how to find if checkbox is checked or not

查看:87
本文介绍了如何查找是否已选中复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于检查转发器控件中是否选中此复选框的Javascript ...



我正在使用一个脚本,该脚本在删除"按钮上显示对话框,但在未选中复选框"时显示对话框:|

Javascript to check if checkbox is checked or not in repeater control...



i''m using one script which shows dialoguebox on Delete button but it is showing dialoguebox when Checkbox is not checked :|

<script type="text/javascript">
function Confirmationbox() {
var result = confirm('Are you sure you want to Delete selected Detail(s)?');
if (result) {
return true;
}
else
return false;
}
</script>

推荐答案

您在代码中的哪个位置检查复选框的状态?尝试这样的操作(不要忘记chk需要引用实际的复选框):
Where in the code are you checking the state of the checkbox? Try something like this (don''t forget that chk needs to reference the actual checkbox):
if (chk.checked == 1) {
  var result = confirm('Are you sure you want to Delete selected Detail(s)?');
  return result
}


祝你好运!


Good luck!


这篇关于如何查找是否已选中复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆