• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiselection without Ctrl,Shift keys

 
Zosia Gargasaite
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How I can select a multiple items in a <Select multiple> tag but not use Ctrl, Shift or any keyboard keys. I want to use mouse left click only WITHOUT DRAGING. How I can prevent unselection for other already selected options?
In other words how to imitate Ctrl key on Select pulldown?
 
christoph weingarten
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i think there is no html-attribute to do so. but you could write a simple javascript-function. something like this would probably work:
function doSelect(itemNo) {
if (document.myForm.mySelection.options[itemNo].selected == true) {
document.myForm.mySelection.options[itemNo].selected = false;
} else {
document.myForm.mySelection.options[itemNo].selected = true; }
}
you have to call this function everytime the user clicks on an option.
i'm not sure, whether the code above runs. maybe you have to fix it a little bit
regards
christoph
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic