someJS

java 代码
  1. 1.遍历table   
  2. var tableObj =document.getElementById("submenu2");   
  3.          if(tableObj!=null&&tableObj.rows.length>1){   
  4.            for(var i=1;i<tableObj.rows.length;i++){   
  5.                var temp=tableObj.rows[i].cells[4].childNodes[0].childNodes[0];   
  6.                if(temp.value==""||isNaN(temp.value))continue;   
  7.                temp.value=parseInt(temp.value)+size;   
  8.                    
  9.            }   
  10.          }   
  11. 2.遍历form   
  12. var objForm = document.forms[formName];        
  13. var objLen = objForm.length;   
  14. for(var iCount = 0; iCount < objLen; iCount++){   
  15. if(chkHeader.checked == true){   
  16. if(objForm.elements[iCount].type == "checkbox" && objForm.elements[iCount].name != 'chkbx_all'){   
  17. objForm.elements[iCount].checked = true;                   
  18. eval(formName+'.chkbx_' + objForm.elements[iCount].name).value='SELECTED';   
  19. }   
  20. }else{   
  21. if(objForm.elements[iCount].type == "checkbox" && objForm.elements[iCount].name != 'chkbx_all'){   
  22. objForm.elements[iCount].checked = false;   
  23. eval(formName+'.chkbx_' + objForm.elements[iCount].name).value='UNSELECTED';   
  24. }   
  25. }   
  26. 3.增加行   
  27. 4.删除行   
  28. //删除表格中的一行   
  29.       function delRow(table){   
  30.         // add by yaol 2007-02-08   
  31.         if(table.id=="table_for_addrow"){   
  32.              if(changeApplyPlanMan(-1)){   //申请人个数减1成功则继续       
  33.                  changeRoleCode(-1);       //让roleCode 显示的减1    
  34.              }    
  35.         }                   
  36.             
  37.          var src=event.srcElement;   
  38.          while(src!=null){   
  39.             if(src.nodeName=="TR"){   
  40.                //table.deleteRow(src.rowIndex);   
  41.                src.removeNode(true);   
  42.                return;   
  43.             }   
  44.             src=src.parentElement;   
  45.          }   
  46.            
  47.           
  48.       }   
  49. 5.all   
  50. a.   
  51. var oObject = document.all.item("sample");//找出id或者name属性为"sample"的元素对象集合   
  52. if (oObject != null){   
  53. if (oObject.length != null){   
  54. for (i = 0; i < oObject.length; i++){   
  55. alert(oObject(i).tagName);   
  56. }   
  57. }   
  58. b.document.all.pageErrorInfo.innerHTML = "";    //"pageErrorInfo"为某元素节点ID   

你可能感兴趣的:(js)