By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

Finding checkboxesl between 2 checkboxes

P: n/a
Hi - I'm using asp.net to draw a grid (dates and people) which is
populated by checkboxes - each check box represents a day and a person
(so for example, I may have 2 weeks showing across the top, with 10
people showing down the side).

Currently, if I click on day 1 person 1, and I want to book their time
for 2 weeks, I have to manually check 14 checkboxes.

Is there a way for me to click on the first checkbox, and then click on
the last one, and have some javascript function populate all the
checkboxes in between?

Thanks for any help,

Mark
*** Sent via Developersdex http://www.developersdex.com ***
Sep 19 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Mark написав:
Hi - I'm using asp.net to draw a grid (dates and people) which is
populated by checkboxes - each check box represents a day and a person
(so for example, I may have 2 weeks showing across the top, with 10
people showing down the side).

Currently, if I click on day 1 person 1, and I want to book their time
for 2 weeks, I have to manually check 14 checkboxes.

Is there a way for me to click on the first checkbox, and then click on
the last one, and have some javascript function populate all the
checkboxes in between?

Thanks for any help,

Mark
var firstCheckBox=... //save reference to checkboxes
var secondCheckBox=... //in this vars
var checkMode=false
var elements=document.forms[0].elements, item
for(var i=0;i<elements.length;i++){
item=elements[i]
if(item.type!='checkbox')continue
if(item==firstCheckBox) { checkMode=true; continue }
if(item==secondCheckBox) break
if(checkMode) item.checked=true
}

Sep 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.