Fred wrote on 13 dec 2006 in comp.lang.javascript:
Thanks for the reply. I was trying to find a way to select a block of
them at one time, without selecting them all. As an example if I had
150 items lists, and only wanted to check 35 of them, would there be a
way to use a shift-click or ctrl-click to just pick that block at one
time.
If you are content with just clicking start and end radiobuttons,
try this:
============= test.html ===================
<script type='text/javascript'>
function slk(){
var start = document.forms[0].start;
for (i=0;i<start.length;i++)
if (start
.checked)
startN = i+1;
var end = document.forms[0].end;
for (i=0;i<end.length;i++)
if (end.checked)
endN = i+1;
if (startN>endN) {
var temp = startN;
startN = endN;
endN = temp;
}
for (i=1;i<=start.length;i++)
document.forms[0].elements['c'+i].checked =
(i>=startN && i<=endN)
}
</script>
<form>
item 1: <input type=checkbox name='c1'>
start: <input type=radio name='start' onclick='slk()' checked>
end: <input type=radio name='end' onclick='slk()'><br>
item 2: <input type=checkbox name='c2'>
start: <input type=radio name='start' onclick='slk()' >
end: <input type=radio name='end' onclick='slk()'><br>
item 3: <input type=checkbox name='c3'>
start: <input type=radio name='start' onclick='slk()'>
end: <input type=radio name='end' onclick='slk()'><br>
item 4: <input type=checkbox name='c4'>
start: <input type=radio name='start' onclick='slk()'>
end: <input type=radio name='end' onclick='slk()'><br>
item 5: <input type=checkbox name='c5'>
start: <input type=radio name='start' onclick='slk()'>
end: <input type=radio name='end' onclick='slk()' checked><br>
</form>
=====================================