js,jquery获取checkbox 记录ID值

时间:2023-01-30 19:36:45
function updateProcess()
  {
   var no = "";
   var checkednum = $("input:checked");
   var len = checkednum.length;
   for ( var i = 0; i < checkednum.length; i++) {
    if(checkednum[i].name == "selectall"){
     len--;
    }
    if (checkednum[i].checked)
     no = checkednum[i].value.split("|")[0];
   }
   if(len == 0){
    alert("请选择要操作的记录");   
   }else if(len > 1){
    alert("一次只能修改一条记录");
   }else{
    window.location.href = "pwmfjumpUpdateProcessName?id="+no;
   }
  }

js方法

 function activeDeptP(obj) {
 var count = 0;
 var userids = document.getElementsByName(obj);
 var str = ""
 var length = userids.length;
 for ( var i = 0; i < length; i++) {
  if (userids[i].checked) {
   str = str + userids[i].value + ",";
   count++;
  }
 }
 if (count == 0) {
  alert("请选择需要操作的记录!");
  return false;
 }
 if (count >1) {
  alert("一次只能选择一个激活!");
  return false;
 }
 var rr = confirm("确定激活?");
 if (rr == true) {
  window.location.href = "<%=basePath%>pwmfactiveOpen?ss=" + str;
 } else {
  return false;
 }
}