2007-10-26

DHTML checkbox 选择的几种应用方法

关键字: DHTML,checkbox,选择,应用,方法,全选,全不选,是否有选择
js 代码
 
  1. //==================================================================================    
  2. // Copyright (c) 1998-2007 by www.bizservice.com.cn, All rights reserved.    
  3. // Email:contact@bizservice.com.cn, HangZhou, China    
  4. //    
  5. // This software is the confidential and proprietary information of    
  6. // Bizservice.Com.Cn. ("Confidential Information"). You shall not disclose    
  7. // such Confidential Information and shall use it only in accordance    
  8. // with the terms of the license agreement you entered into with Bizservice.Com.Cn.    
  9. //==================================================================================    
  10. // Author: Wilson Lin    
  11. // Date: 2004-6-15 14:19:50    
  12. // Description:        
  13. //     无    
  14. // Function List:         
  15. //     1. 无    
  16. // History:    
  17. //     1. 无    
  18. //==================================================================================    
  19.     
  20. // 全选    
  21. function checkAll(form) {    
  22.     for (var i=0; i
  23.        var e = form.elements[i];    
  24.        if (e.type=="checkbox")    
  25.            e.checked = true ;    
  26.     }    
  27. }    
  28.     
  29. // 全不选    
  30. function checkNotAll(form) {    
  31.     for (var i=0; i
  32.        var e = form.elements[i];    
  33.        if (e.type=="checkbox")    
  34.            e.checked = false ;    
  35.     }    
  36. }    
  37.     
  38. // 是否有选中的项    
  39. function isChecked(form){    
  40.     for (var i=0; i
  41.        var e = form.elements[i];    
  42.        if (e.type=="checkbox"){    
  43.            if(e.checked){    
  44.               return true;    
  45.            }    
  46.        }    
  47.     }    
  48.     return false;    
  49. }    
评论
congpeixue 2008-04-17
function doFlgCheckedCheck() {
if (document.mainForm.checkFlgArray != undefined) {
var len = document.mainForm.checkFlgArray.length;
var checkedCnt = 0;
if (len > 1){
for (var i = 0; i < len; i++){
if (document.mainForm.checkFlg[i].checked == true){
checkedCnt++;
}
if (checkedCnt < 1){
document.mainForm.document.mainForm.checkFlg[0].checked = true;
showAlert(SY001MCE0038);
return false;
}
}
} else {
if (document.mainForm.checkFlg.checked == true){
checkedCnt++;
}
if (checkedCnt < 1){
document.mainForm.document.mainForm.checkFlg.checked = true;
showAlert(SY001MCE0038);
return false;
}
}
}
return true;
}
i_love_sc 2007-10-26
就这几行破代码还加个版权,哎。
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论