C
Csaba Gabor
Sometimes you want to check a (continguous) range of
checkboxes. I've implemented this in Greasemonkey and
Gmail does it too: When you press the shift key while clicking
a checkbox, all checkboxes between the last clicked checkbox
and the current one take on the state of the newly toggled
checkbox.
Now I have a situation where I've got rows in a table, but no
checkboxes. No problem, same basic code. However, there
is an issue. When I hold down the shift key, all the text
between the prior location and the place where I've clicked
gets selected. This is very irritating. I thought I could get
rid of this effect by doing something like:
var shiftP = evt.modifiers ?
evt.modifiers & Event.SHIFT_MASK :
(evt.shiftKey || false);
if (shiftP) {
if (evt.preventDefault) evt.preventDefault();
evt.cancelBubble = true;
evt.returnValue = false; }
but this gives me no joy. I can, of course, explicitly
collapse the selection, but isn't there a more standard way
that I'm missing?
Thanks,
Csaba Gabor from Vienna
checkboxes. I've implemented this in Greasemonkey and
Gmail does it too: When you press the shift key while clicking
a checkbox, all checkboxes between the last clicked checkbox
and the current one take on the state of the newly toggled
checkbox.
Now I have a situation where I've got rows in a table, but no
checkboxes. No problem, same basic code. However, there
is an issue. When I hold down the shift key, all the text
between the prior location and the place where I've clicked
gets selected. This is very irritating. I thought I could get
rid of this effect by doing something like:
var shiftP = evt.modifiers ?
evt.modifiers & Event.SHIFT_MASK :
(evt.shiftKey || false);
if (shiftP) {
if (evt.preventDefault) evt.preventDefault();
evt.cancelBubble = true;
evt.returnValue = false; }
but this gives me no joy. I can, of course, explicitly
collapse the selection, but isn't there a more standard way
that I'm missing?
Thanks,
Csaba Gabor from Vienna