Using the HTML Form Elements Array : CheckBox : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » CheckBox »

 

Using the HTML Form Elements Array



<HTML>
<HEAD>
<TITLE>Elements </TITLE>
</HEAD>
<BODY>
<SCRIPT
   function uClicked (theBox){ 
      if (!theBox.checked
         alert ("You unchecked the box.")
      else 
         alert ("You checked the box.")
   
   function clearChecks(form){ 
      for (var i = 0; i < 100; ++i) { 
         form.elements[i].checked = false
      
   
   function checkAll(form){ 
      for (var i = 0; i < 100; ++i) { 
         form.elements[i].checked = true
      
   
   </SCRIPT>
<form><CENTER>
<INPUT TYPE="checkbox" onClick="uClicked(this)">
<INPUT TYPE="checkbox" onClick="uClicked(this)">
<INPUT TYPE="checkbox" onClick="uClicked(this)">
<INPUT TYPE="checkbox" onClick="uClicked(this)">
<INPUT TYPE="checkbox" onClick="uClicked(this)">
<INPUT TYPE="checkbox" onClick="uClicked(this)">

<INPUT TYPE="button" VALUE="Check All" onClick="checkAll(this.form)">
<INPUT TYPE="button" VALUE="Clear Checks" onClick="clearChecks(this.form)">
</FORM>


</BODY>
</HTML>
           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» CheckBox