WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Javascript Multi-Checkbox Checker
Categories : Java Script, Form Processing Click here to Update Your Picture
Wilson Aquino
Date : Dec 20th 2007
Grade : 1 of 5 (graded 1 times)
Viewed : 4023
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Wilson Aquino
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

Well, this isn't a large file or even need another file, so I'll put all the code here.

This "Multi-Checkbox Checker" it's a good idea for those who have forms with a big amount of checkbox.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Multi-Checkbox Checker</title>
<script language="javascript">
function getElement(e){
    if(document.getElementById(e)){ var obj = document.getElementById(e);
    }else if(document.getElementsByName(e)){ var obj = document.getElementsByName(e);
    }else if(document.all){ var obj = document.all[e];
    }else{ return false; }
    return obj;
}
var checked = false;
function multi_check(form, me){
/// form = form id
/// me = toggler id (optional)
    var form = elements = document.forms[form];
    if(form == null || form == 'undefined'){ return false; }
    elements = form.elements;
    ///->
    var found = false;
    var chk_box = new Array();
    var unchk_box = new Array();
    var chk_num = 0;
    var unchk_num = 0;
    ///->
    var me_found = false;
    var its_me = '';
    if(me != null && me != 'undefined'){ var find_me = true; }else{ var find_me = false; }
    ///->
    for(var i = 0; i < elements.length; i++){
        if(elements[i].type == 'checkbox' && elements[i].name != me){
            found = true;
            if(elements[i].checked){ chk_box[chk_num] = elements[i]; chk_num++;
            }else{ unchk_box[unchk_num] = elements[i]; unchk_num++; }
        }else if(elements[i].name == me && find_me){
            if(elements[i].type == 'checkbox'){ its_me = elements[i]; me_found = true;
            }else{ find_me = false; me_found = false; }
        }
    }
    ///->
    if(!me_found){ if(getElement(me)){ me_found = true; its_me = getElement(me); } }
    if(!found){ return false; }
    if(unchk_num == 0){ checked = true; }
    if(checked && find_me && me_found){ its_me.checked = false; }
    ///->
    if(unchk_box.length && !checked){
        for(var un = 0; un < unchk_box.length; un++){
            unchk_box[un].checked = true;
        }
        checked = true;
    }else{
        for(var ch = 0; ch < chk_box.length; ch++){
            if(checked){ chk_box[ch].checked = false; }
        }
        checked = false;
    }
    return false;
}
</script>
</head>

<body>
<form action="#" id="cc">
    <a href="#" onclick="multi_check('cc'); return false;">Check/Uncheck All</a>
    <input type="checkbox" />
    <input type="checkbox" />
    <input type="checkbox" />
    <input type="checkbox" />
</form>
</body>
</html>



Form validations using javascript and including all validations in one message
Categories : HTML and PHP, Java Script, Form Processing
showing Help (assistance) to the user while filling html forms.
Categories : HTML, Java Script, Form Processing
Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
Hilight Form Element onFocus
Categories : Java Script, Form Processing, CSS
Upload any fixed type of files, control file type through javascript and encrypt filename using php so file not get overwrite
Categories : PHP, Java Script, Functions, PHP References, Form Processing
Adding a Filter to a Text Element
Categories : Java Script, Data Validation, Form Processing
Changing the Style of form objects using the JavaScript OnClick method.
Categories : Java Script, Form Processing, Beginner Guides, CSS
PHP and javascript mouseover, mouseout, and mousedown events
Categories : PHP, Java Script, Form Processing, Beginner Guides
Balance values between two list boxes. Change the value of list box A acording to the value in list box B and vice versa using Javasvript.
Categories : Java Script, Form Processing
JavaScript dropdown list menu to switch any page.
Categories : Java Script, Beginner Guides, Form Processing
Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
Javascript URL and Email Validation
Categories : Java Script, Data Validation, Form Processing, Email, URLs
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
Java Script which implements a Clock (Client Side)
Categories : Java Script, Date Time
AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page.
Categories : PHP, AJAX, Databases, MySQL, Java Script