JavaScript All-in-selection reverse: Select/Reverse/local

Source: Internet
Author: User

Select All

 
  
 
  1. SelectAll (obj) {
  2. for (var i = 0; i < obj.elements.length; i++) {
  3. if (Obj.elements[i].type = = "checkbox") {
  4. Obj.elements[i].checked = true;
  5. }
  6. }
  7. }

Multi-selection box anti-selection

 
  
 
  1. Selectother (obj) {
  2. for (var i = 0; i < obj.elements.length; i++) {
  3. if (Obj.elements[i].type = = "checkbox") {
  4. if (!obj.elements[i].checked) {
  5. Obj.elements[i].checked = true;
  6. } else {
  7. obj.elements[i].checked = false;
  8. }
  9. }
  10. }
  11. }

Resets the value of a multiple-selection box based on the value of the checkbox for the previous layer component

 
  
 
  1. SelectObject (e,obj) {
  2. var CheckBoxList = getElementById (obj). getElementsByTagName ("input");
  3. for (i = 0; i < checkboxlist.length; i++) {
  4. if (Checkboxlist[i].type = = "checkbox") {
  5. checkboxlist[i].checked = e;
  6. }
  7. }
  8. }

Resets the previous checkbox value based on the value of the checkbox for the next layer of component, and the previous layer is true if at least 1 of the next layer is true

 
  
 
  1. Selecthigher (E,higherobjid,objid) {
  2. var CheckBoxList = getElementById (ObjID). getElementsByTagName ("input");
  3. var highercheckobj = getElementById (Higherobjid);
  4. if (E = = True) {
  5. highercheckobj.checked = e;
  6. } else {
  7. for (i = 0; i < checkboxlist.length; i++) {
  8. if (Checkboxlist[i].type = = "checkbox" && checkboxlist[i].checked = = e) {
  9. highercheckobj.checked = e;
  10. }
  11. }
  12. }
  13. }
This article links http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20130529/38126.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.