Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple select 2

Status
Not open for further replies.

cschaffer

IS-IT--Management
Aug 21, 2001
196
0
0
CA
I need the following help...
in a multiple select object, i want the user to be able to select multiple items....without pressing shift or ctrl....i have seen this...is there a way!!??..Thanks

 
Do you mean this:

<select NAME=&quot;list1&quot; SIZE=3 MULTIPLE>

Hope this helps,
Erik
<-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
true, that is a multiple select element, but the user must still press ctrl while clicking his itmes from the list...i wnat the user to be able to select items without pressing ctrl or shift......thanhks for your reply!
 
The box you've seen is probably like a &quot;Simple&quot; listbox (as opposed to an &quot;Extended&quot; listbox) that you would see in a program like Microsoft Access. The web page version is not as flexible. You could click and drag to select multiple options, but to be able to select non-consecutive options you would have to create your own select box. I created and tested this in IE 5.5:

Code:
<html>
<head>
<style>
.customSelect{
  border: inset;
  font-family: MS Sans Serif;
  font-size: 80%;
  width: 0%;
  cursor: default;
}
</style>
<script>
function toggleHighlight(div,sel,num){
  option=document.f[sel][num]
  div.style.color=(option.selected ? 'black':'highlighttext');
  div.style.backgroundColor=(option.selected ? 'white':'highlight');
  option.selected=!option.selected;
}
</script>
</head>
<body>
<form name=&quot;f&quot;>
<span class=&quot;customSelect&quot;>
  <div onclick=&quot;toggleHighlight(this,'myselect',0)&quot; onselectstart=&quot;return false&quot;><nobr>Option 1</nobr></div>
  <div onclick=&quot;toggleHighlight(this,'myselect',1)&quot; onselectstart=&quot;return false&quot;><nobr>Option 2</nobr></div>
  <div onclick=&quot;toggleHighlight(this,'myselect',2)&quot; onselectstart=&quot;return false&quot;><nobr>Option 3</nobr></div>
</span>
<select name=&quot;myselect&quot; multiple style=&quot;display:none&quot;>
  <option value=&quot;Value 1&quot;>
  <option value=&quot;Value 2&quot;>
  <option value=&quot;Value 3&quot;>
</select>
<input type=&quot;submit&quot;>
</form>
</body>
</html>
______________________________________________________________________________________________________________________________________ Adam
 
Adam,

that is a brilliant solution...i had been trying to figure out how to code this type of multiple select for a while. never would have thought to use a hidden multiple select in a hundred years.

i had been trying to alter the select directly with script, and the problem that i was stuck on was getting the index of the option that received the click - your method renders this unnecessary! =========================================================
if (!succeed) try();
-jeff
 
yes, thanks..I can work with this...I too was thinking the only way was to send the indexof the selected item!..thanks

C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top