日期:2014-05-16  浏览次数:20330 次

js获取带checkbox行的记录的Id值的两个方法

第一种:

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;
???}
??}

***********************************

第二种:

? //激活部门流程
??? 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;
?}

}

?