PDA

Click to See Complete Forum and Search --> : Select All?


gilly
Nov 2nd, 2000, 06:50 AM
Does anyone know the syntax for a "Select all" option??.

I have an asp page with check boxes allowing the user to select(check) one by one. However i want to give the user the option of select all (batch) in one go.

ANy ideas...

monte96
Nov 2nd, 2000, 09:38 AM
Give all of your checkboxes the same ID (I'm assuming your creating these checkboxes dynamically in a loop), and reference them using the index..

This code will actually toggle the checked state:

Sub cmdCheckAll_onclick
Dim lngLoop
on error resume next

for lngLoop = 0 to document.all.length
If document.all.item(lngLoop).id = "chkMyCheckBox" Then
document.all.item(lngLoop).Checked = not(document.all.item(lngLoop).Checked)
End If
Next

End Sub