Question:An HTML form contains 10 checkboxes all named " chkItems ". Which JavaScript function can be used for checking all the checkboxes together? 

A 
function CheckAll()
   {
           for (z = 0; z < document.forms.chkItems.length; z++)
           {
           document.forms.chkItems[z].checked=true
           }
   }
 

B 
function CheckAll()
   {
           for (z = 0; z < document.forms[0].chkItems.length; z++)
           {
           document.forms[0].chkItems[z].checked=true
           }
   }
 

C 
function CheckAll()
   {
           for (z = 0; z < document.forms[0].chkItems.length; z++)
           {
           document.forms[0].chkItems.list[z].checked=true
           }
   }
 

D 
function CheckAll()
   {
           for (z = 0; z < document.forms[0].chkItems.length; z++)
           {
           document.forms[0].chkItems.list[z].checked=false
           }
   }
 

+ Answer
+ Report
Total Preview: 998

Copyright © 2024. Powered by Intellect Software Ltd