aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Multiselection without Ctrl,Shift keys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Multiselection without Ctrl,Shift keys" Watch "Multiselection without Ctrl,Shift keys" New topic
Author

Multiselection without Ctrl,Shift keys

Zosia Gargasaite
Greenhorn

Joined: Nov 28, 2002
Posts: 1
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

Joined: Oct 10, 2002
Posts: 39
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiselection without Ctrl,Shift keys