Results 1 to 2 of 2

Thread: Select All?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Talking

    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...
    Gilly

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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:
    Code:
    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
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width