Toggle Input Checkboxs

This is a "how-to" I've wanted for working with HTA and other web apps.

Add a 'chkAll' input box to your form and
and onclick event which calls the routine shown. An 'all' click will toggle checkbox state of all INPUT checkboxes on the page or form. You can then set items individually...

Sub chkAll_Click
 Dim _
 laaa, _
 chkBox, _
 oTag, _
 lzzz
 '-
 Set chkBox = _
       document.getElementsByTagName("input")
 For  each oTag in chkBox
  If oTag.type = "checkbox" and _
     oTag.id<>"chkAll" Then
   If oTag.checked = vbTrue Then
    oTag.checked = vbFalse         
   Else
    oTag.checked = vbTrue         
   End If     
  End If 
 Next
End Sub

No comments:

Favorite Tweets