dev-exchange.com logo

dev-exchange.com latest topics RSS feed

Book mark: Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to your delicious account Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to your digg account Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to your blinklist account Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to your reddit account Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to Dzone Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to your furl account Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to your stumble account Add http://www.dev-exchange.com/cms_view_article.php?aid=7&start=0 to your Yahoo myweb account
Article Menu
Google
ColdFusion MX
PHP
ASP
ASP.Net
XML-XSLT
JavaScript
SQL Server
AJAX
 


 
Article
Jacobs
Contributing Member
Contributing Member

Articles: 2 Comments: 3
 Posted: Wed Jun 06, 2007 4:12 pm

This article example shows how to implement select/deselect a check box group using one main check box.
Example given here has tested only on IE and Firefox so you may want to try and test it before using this in your web pages . Please post your comments on this article if you have any.


Code:
<script type="text/javascript">
<!--
 function CheckORUnCheck (chkBox) {
     var arrVals = document.getElementsByTagName("input");
     for (x=0; x<arrVals.length; x++) {
         if (arrVals[x].type == 'checkbox') {
           if (chkBox.checked==true){
             // select mode
             arrVals[x].checked = true;
          }else{
          //deselect mode
             arrVals[x].checked = false;
          }         
         }
      }         
 }
 -->
 </script>

 <strong>Play List:</strong>
 
 <form id="checkboxtest" method="get" action="">
   <input type="checkbox" name="chk_main" id="chk_main" value="" onClick="CheckORUnCheck(this);" />
   Select or Deselect all songs<br />
   <input type="checkbox" name="chk_1" id="chk_1" value="1" /> Song 1 <br />
   <input type="checkbox" name="chk_2" id="chk_2" value="2" /> Song 2 <br />
   <input type="checkbox" name="chk_3" id="chk_3" value="3" /> Song 3 <br />
   <input type="checkbox" name="chk_4" id="chk_4" value="4" /> Song 4 <br />
   <input type="checkbox" name="chk_5" id="chk_5" value="5" /> Song 5 <br />
 </form>
 



Happy Programming!
Rating: 0.00/5.00 [0]

Comments
No comments were made for this article
 

All times are GMT

Jump to:  
You cannot post articles in this chapter
You cannot edit your articles in this chapter
You cannot delete your articles in this chapter
You cannot rate articles in this chapter

You cannot post comments in this chapter
You cannot edit your comments in this chapter
You cannot delete your comments in this chapter
You cannot rate comments in this chapter


© 2008 dev-exchange.com
Powered by phpBB. Theme DEVPPL.