Click to See Complete Forum and Search --> : Multiple Selection in Select Object in HTML ?


tastecode
May 14th, 2003, 03:26 PM
hi,
SELECT MULTIPLE Allows more than one choice to be selected,but must hold down the CTRL key while selecting.
How doesn't hold down the CTRL key while multiple selecting?
THANK YOU!

Satishpp
May 14th, 2003, 06:22 PM
I am not sure I understand your question...:confused:

You can select multiple values from a multi select - select box either by
1) holding CTRL key and selecting with the mouse
2) Clicking and draging the mouse over succesive options
3) holding Shift and clicking on 2 seperate options - whereby all option in between will be selected
4) Using Shift and arrow keys to select options

If your question is - How to select multiple options without pressing down CTRL - 2,3 and 4 above answer your question.

If your question is - How to select multiple options without having to hold down any key, point 2 above answers your question.

If it is none of the above... Kindly elaborate...:D

Satish

antares686
May 15th, 2003, 06:36 AM
If you question is how do you select multiple non-consective items without holding the CTRL the answer is you really cannot. You might however try creating an array to rememeber which items are selected and using javascript set the items selected that are clicked. Here is a concept piece I started to work on


<HTML>
<script language=javascript>
var arSels = new Array();

function NoCtrl() {
for (i = 0; i < 8; i++) {
if (arSels[i] == Items.selectedIndex)
{
delete arSels[i];
// alert('remove');
// alert(arSels[i]);
Items.options[Items.selectedIndex].selected = false;
break;
}
else
{
if (arSels[i] == null)
{
arSels[i] = Items.selectedIndex;
// alert('add');
break;
}
}
}

for (i = 0; i < 8; i++) {
if (arSels[i] != null)
{
Items.options[arSels[i]].selected = true;
}
}
}
</script>

<BODY>

<select name=Items multiple size=4 style="width:50px" OnChange="NoCtrl()">
<option value=1>1
<option value=2>2
<option value=3>3
<option value=4>4
<option value=5>5
<option value=6>6
<option value=7>7
</select>

</BODY>
</HTML>

tastecode
May 19th, 2003, 09:28 PM
Although that code can realize the function that
selections be made without using the Ctrl key, all
newly-made selections will be ranked last, instead of
remaining in their original positions (when the
rolling bar is not positioned at the top or the
bottom).
For example:
54511
54512
54513
54514
54515
The current select board displays the above
information( the rolling bar is in the middle),and
Item 54512 is positioned second. But when it is
selected, it will be listed the last.
What are the solutions to this problem?

antares686
May 20th, 2003, 06:56 AM
As I said it was a concept piece. I have not done anymore too it. I had it just lying around not being used. If I find time to play with I will pass along anything I find.