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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help !! Populate Drop down list

Status
Not open for further replies.

HOTLIPS

Technical User
Dec 5, 2000
55
GB
Hi
I want to dynamically populate a drop down list from a list of names.........I would like to select, say all names beginning with a particular letter and filter those names out and dynamically populate the dropdown selection list....and then be able to select a name from the filtered list.
vis :
I would like letters of alphabet on page... when clicking a letter...the selection list would only show those names beginning with that particular letter..... in other words it would be minimizing the selection list.

Can Any one help ?????

Hotlips
 
<script>
allNames = new Array(&quot;Adam&quot;,&quot;Albert&quot;,&quot;Andrea&quot;,&quot;Bill&quot;,&quot;Barb&quot;,&quot;Betty&quot;,&quot;Chris&quot;,&quot;Carl&quot;)

function loadSelect(letter){
sList = document.getElementById(&quot;mySelect&quot;)
//clear select first
for (x=1; x<sList.options.length; x++){
sList.options[x] = null
}
//now load list
var listCount = 0
for(x=0; x<allNames.length; x++){
if(allNames[x].substr(0,1) == letter){
sList.options[listCount] = new Option(allNames[x], allNames[x])
listCount ++
}
}
}
</script>
<body onLoad=&quot;loadSelect('A')&quot;>
<form name=&quot;myForm&quot;>
<select name=&quot;mySelect&quot; id=&quot;mySelect&quot;><option></select>
</form>
<br>
<a href=&quot;javascript: loadSelect('A')&quot;>A</a>
<br>
<a href=&quot;javascript: loadSelect('B')&quot;>B</a>
<br>
<a href=&quot;javascript: loadSelect('C')&quot;>C</a>
<br>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Here's an addition to mwolf00's script to help write out all those links:
Code:
<script>
var alphabet=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;
for(var i=0;i<26;i++){
  document.writeln(&quot; <a href=\&quot;javascript:loadSelect('&quot;+alphabet.charAt(i)+&quot;')\&quot;>&quot;+alphabet.charAt(i)+&quot;</a> &quot;+(i!=25?'|':''));
}
</script>

Adam
while(woman.width>woman.height && wallet.value>0){beer++;vision.blur()};
 
Hi again
Got a bit of a problem......
when I select a letter and minimise the list...say a list of 20 names beginning with H.... then I select a letter ....say G and only 5 names .... there is a mixed list of G names and H names.... is there any way to clear the list and only show the names beginning with that particular letter selected.....
And if I select say X.... and there are no names beginning with X then the list should be blank
Can u help ???

Hotlips
 
This bit of code (already in the script) should be doing that....

//clear select first
for (x=1; x<sList.options.length; x++){
sList.options[x] = null
}

If you run my code as posted and click on &quot;C&quot; the list only has 2 names on it after having 3 &quot;A&quot; names....

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Thanks for that ... maybe I am nitpicking.. but look at my code and u will see what I mean... click B then try E... the names are mixed.....

<script>
var allNames = new Array();
allNames[0] =&quot;&quot;
allNames[1] =&quot;8t25&quot;
allNames[2] =&quot;Abbott A W&quot;
allNames[3] =&quot;Allport B&quot;
allNames[4] =&quot;Andrews P&quot;
allNames[5] =&quot;Antcliffe D&quot;
allNames[6] =&quot;Apps C&quot;
allNames[7] =&quot;Armstrong D&quot;
allNames[8] =&quot;Ashurst N&quot;
allNames[9] =&quot;Atherton H&quot;
allNames[10] =&quot;Bailey G&quot;
allNames[11] =&quot;Bailey R&quot;
allNames[12] =&quot;Baker G&quot;
allNames[13] =&quot;Baker K&quot;
allNames[14] =&quot;Ball R&quot;
allNames[15] =&quot;Ballantyne J&quot;
allNames[16] =&quot;Bannister D&quot;
allNames[17] =&quot;Bannister F&quot;
allNames[18] =&quot;Bell A&quot;
allNames[19] =&quot;Bell R&quot;
allNames[20] =&quot;Beswick H&quot;
allNames[21] =&quot;Beswick K&quot;
allNames[22] =&quot;Blair J&quot;
allNames[23] =&quot;Blakely&quot;
allNames[24] =&quot;Blakely R&quot;
allNames[25] =&quot;Blundell A&quot;
allNames[26] =&quot;Boyack I&quot;
allNames[27] =&quot;Bradford Stores&quot;
allNames[28] =&quot;Bramhall C&quot;
allNames[29] =&quot;Brannigan J&quot;
allNames[30] =&quot;Bremner A&quot;
allNames[31] =&quot;Brown A&quot;
allNames[32] =&quot;Brown C&quot;
allNames[33] =&quot;Brown H M&quot;
allNames[34] =&quot;Brown I&quot;
allNames[35] =&quot;Brown I R&quot;
allNames[36] =&quot;Budenburg&quot;
allNames[37] =&quot;Bulley P.&quot;
allNames[38] =&quot;Bulmer S&quot;
allNames[39] =&quot;Burdis R&quot;
allNames[40] =&quot;Butcher C&quot;
allNames[41] =&quot;Butler M&quot;
allNames[42] =&quot;Cameron D&quot;
allNames[43] =&quot;Chandon Singh&quot;
allNames[44] =&quot;Chandrasergan V&quot;
allNames[45] =&quot;Chapman J&quot;
allNames[46] =&quot;Cherry S&quot;
allNames[47] =&quot;Chislett R&quot;
allNames[48] =&quot;Clark J&quot;
allNames[49] =&quot;Clarke R&quot;
allNames[50] =&quot;Clarke W A&quot;
allNames[51] =&quot;Clements S&quot;
allNames[52] =&quot;Coblenz E&quot;
allNames[53] =&quot;Coblenz R&quot;
allNames[54] =&quot;Cochran B&quot;
allNames[55] =&quot;Cochrane J&quot;
allNames[56] =&quot;Colley S S&quot;
allNames[57] =&quot;Connel P&quot;
allNames[58] =&quot;Connelly T&quot;
allNames[59] =&quot;Cooper P&quot;
allNames[60] =&quot;Cormac A&quot;
allNames[61] =&quot;Coughlin J&quot;
allNames[62] =&quot;Cowan D&quot;
allNames[63] =&quot;Cowie C&quot;
allNames[64] =&quot;Crane B&quot;
allNames[65] =&quot;Crawford A&quot;
allNames[66] =&quot;Crawley P&quot;
allNames[67] =&quot;Creed S&quot;
allNames[68] =&quot;Creek G&quot;
allNames[69] =&quot;Crichton C&quot;
allNames[70] =&quot;Crogan M&quot;
allNames[71] =&quot;Cunningham W&quot;
allNames[72] =&quot;Cutler H&quot;
allNames[73] =&quot;Dadd A&quot;
allNames[74] =&quot;Dastl E&quot;
allNames[75] =&quot;Davis A C&quot;
allNames[76] =&quot;Davis S&quot;
allNames[77] =&quot;Davison S&quot;
allNames[78] =&quot;Derby&quot;
allNames[79] =&quot;Devlin K&quot;
allNames[80] =&quot;Dew J&quot;
allNames[81] =&quot;Diamond J&quot;
allNames[82] =&quot;Dickson J&quot;
allNames[83] =&quot;Docking F&quot;
allNames[84] =&quot;Dodd D&quot;
allNames[85] =&quot;Domzalski M&quot;
allNames[86] =&quot;Dowds P&quot;
allNames[87] =&quot;Dowell P&quot;
allNames[88] =&quot;Dowling P&quot;
allNames[89] =&quot;Drakelow&quot;
allNames[90] =&quot;Elder J&quot;
allNames[91] =&quot;Farr R&quot;
allNames[92] =&quot;Fay K&quot;
allNames[93] =&quot;Fay P&quot;
allNames[94] =&quot;Fearn A&quot;
allNames[95] =&quot;Fell M&quot;
allNames[96] =&quot;Fenwick N&quot;
allNames[97] =&quot;Foreman W&quot;
allNames[98] =&quot;Fretwell T&quot;
allNames[99] =&quot;Galagher H&quot;
allNames[100] =&quot;Garside M R&quot;
allNames[101] =&quot;Gibson P&quot;
allNames[102] =&quot;Glaze J&quot;
allNames[103] =&quot;Goldshaw S&quot;
allNames[104] =&quot;Goodchild P&quot;
allNames[105] =&quot;Gray D&quot;
allNames[106] =&quot;Greensmith R&quot;
allNames[107] =&quot;Griffin B&quot;
allNames[108] =&quot;Grundy B&quot;
allNames[109] =&quot;Gultig W&quot;
allNames[110] =&quot;Gunning G&quot;
allNames[111] =&quot;Haddock P&quot;
allNames[112] =&quot;Haddow B&quot;
allNames[113] =&quot;Hagan J&quot;
allNames[114] =&quot;Hall M&quot;
allNames[115] =&quot;Halliday S&quot;
allNames[116] =&quot;Hampshire D M&quot;
allNames[117] =&quot;Hannett B&quot;
allNames[118] =&quot;Hardy G&quot;
allNames[119] =&quot;Hari Krishana&quot;
allNames[120] =&quot;Hari Rao Krish&quot;
allNames[121] =&quot;Harpham S&quot;
allNames[122] =&quot;Harrison S.&quot;
allNames[123] =&quot;Harvey TD&quot;
allNames[124] =&quot;Hebburn Stores&quot;
allNames[125] =&quot;Henry Colin&quot;
allNames[126] =&quot;Hensby C&quot;
allNames[127] =&quot;Herbert O&quot;
allNames[128] =&quot;Herrity R&quot;
allNames[129] =&quot;Hewling K&quot;
allNames[130] =&quot;Hill D&quot;
allNames[131] =&quot;Hillman B&quot;
allNames[132] =&quot;Hilyer J&quot;
allNames[133] =&quot;Holdsworth T&quot;
allNames[134] =&quot;Hopkins B&quot;
allNames[135] =&quot;Hughes A&quot;
allNames[136] =&quot;Hughes P&quot;
allNames[137] =&quot;Isaacs S&quot;
allNames[138] =&quot;Jackson M&quot;
allNames[139] =&quot;James R&quot;
allNames[140] =&quot;Jamieson T&quot;
allNames[141] =&quot;Jarnie D&quot;
allNames[142] =&quot;Jones C&quot;
allNames[143] =&quot;Jones G&quot;
allNames[144] =&quot;Jones M.&quot;
allNames[145] =&quot;Jones S&quot;
allNames[146] =&quot;Joyce T&quot;
allNames[147] =&quot;Kamaladoss B&quot;
allNames[148] =&quot;Keigan K&quot;
allNames[149] =&quot;Kemp N&quot;
allNames[150] =&quot;Kesdby&quot;
allNames[151] =&quot;Key M&quot;
allNames[152] =&quot;Kidd M&quot;
allNames[153] =&quot;King B&quot;
allNames[154] =&quot;Kirkley V J&quot;
allNames[155] =&quot;Kirkup S&quot;
allNames[156] =&quot;Kit 23&quot;
allNames[157] =&quot;Kit 24&quot;
allNames[158] =&quot;Kitchen&quot;
allNames[159] =&quot;Klofta E&quot;
allNames[160] =&quot;Klyn M&quot;
allNames[161] =&quot;Knowles J&quot;
allNames[162] =&quot;Laffey L&quot;
allNames[163] =&quot;Laing D&quot;
allNames[164] =&quot;Lamont T&quot;
allNames[165] =&quot;Laws J&quot;
allNames[166] =&quot;Lear S&quot;
allNames[167] =&quot;Leeds Stores&quot;
allNames[168] =&quot;Lenney D&quot;
allNames[169] =&quot;Leyland I&quot;
allNames[170] =&quot;Lindsay N&quot;
allNames[171] =&quot;Livingstone I&quot;
allNames[172] =&quot;Major M&quot;
allNames[173] =&quot;Manufacturer&quot;
allNames[174] =&quot;Marchant M&quot;
allNames[175] =&quot;Marjoram P&quot;
allNames[176] =&quot;Marshall C&quot;
allNames[177] =&quot;Marshall S C&quot;
allNames[178] =&quot;Marsland J&quot;
allNames[179] =&quot;Martin B&quot;
allNames[180] =&quot;Maskell K&quot;
allNames[181] =&quot;Mason J&quot;
allNames[182] =&quot;Mason P&quot;
allNames[183] =&quot;Mc Lean R.&quot;
allNames[184] =&quot;McCabe S&quot;
allNames[185] =&quot;McCollum C J&quot;
allNames[186] =&quot;McDonald D&quot;
allNames[187] =&quot;McGeagh D&quot;
allNames[188] =&quot;McGeough D&quot;
allNames[189] =&quot;McGourley E&quot;
allNames[190] =&quot;McIntyre W&quot;
allNames[191] =&quot;McKenzie C&quot;
allNames[192] =&quot;McKenzie M&quot;
allNames[193] =&quot;McMahon C&quot;
allNames[194] =&quot;McMahon W&quot;
allNames[195] =&quot;McMenamin D&quot;
allNames[196] =&quot;McPhearson K&quot;
allNames[197] =&quot;McQuire B&quot;
allNames[198] =&quot;Meakin P&quot;
allNames[199] =&quot;Miller R&quot;
allNames[200] =&quot;Mitchell T.D&quot;
allNames[201] =&quot;Moody M&quot;
allNames[202] =&quot;Moody N&quot;
allNames[203] =&quot;Moore P&quot;
allNames[204] =&quot;Moorhouse D&quot;
allNames[205] =&quot;Moorhouse P&quot;
allNames[206] =&quot;Moran P&quot;
allNames[207] =&quot;Morrow A.&quot;
allNames[208] =&quot;Munro A&quot;
allNames[209] =&quot;Munro JJ&quot;
allNames[210] =&quot;Murphy P&quot;
allNames[211] =&quot;Napper A&quot;
allNames[212] =&quot;Naveet J&quot;
allNames[213] =&quot;Nelson E&quot;
allNames[214] =&quot;Nesbitt C&quot;
allNames[215] =&quot;Nesbitt K&quot;
allNames[216] =&quot;Nesbitt M&quot;
allNames[217] =&quot;Newby J D&quot;
allNames[218] =&quot;Nicdao F&quot;
allNames[219] =&quot;Nichols C&quot;
allNames[220] =&quot;Nicholson J S&quot;
allNames[221] =&quot;Not. Allocated&quot;
allNames[222] =&quot;O'Brien A&quot;
allNames[223] =&quot;O'Hare T&quot;
allNames[224] =&quot;Oakes J G&quot;
allNames[225] =&quot;Obradovic M&quot;
allNames[226] =&quot;Oley H&quot;
allNames[227] =&quot;Padhye R&quot;
allNames[228] =&quot;Panametrics&quot;
allNames[229] =&quot;Parker B&quot;
allNames[230] =&quot;Parker G&quot;
allNames[231] =&quot;Patterson D&quot;
allNames[232] =&quot;Patterson K&quot;
allNames[233] =&quot;Patterson M&quot;
allNames[234] =&quot;Pearson S G&quot;
allNames[235] =&quot;Piggin S&quot;
allNames[236] =&quot;Platts J&quot;
allNames[237] =&quot;Pritchard A&quot;
allNames[238] =&quot;Prout P&quot;
allNames[239] =&quot;Pullman&quot;
allNames[240] =&quot;Quarantine&quot;
allNames[241] =&quot;RAO KHK&quot;
allNames[242] =&quot;Radhakrishnan S&quot;
allNames[243] =&quot;Redshaw S&quot;
allNames[244] =&quot;Reed F&quot;
allNames[245] =&quot;Reed Les&quot;
allNames[246] =&quot;Reed P&quot;
allNames[247] =&quot;Renwick R&quot;
allNames[248] =&quot;Richardson C&quot;
allNames[249] =&quot;Ridge E&quot;
allNames[250] =&quot;Roberts D&quot;
allNames[251] =&quot;Roberts S.&quot;
allNames[252] =&quot;Roberts T&quot;
allNames[253] =&quot;Robertson S&quot;
allNames[254] =&quot;Robinson D&quot;
allNames[255] =&quot;Robinson K&quot;
allNames[256] =&quot;Robson S&quot;
allNames[257] =&quot;Rogers G&quot;
allNames[258] =&quot;Rumbold D&quot;
allNames[259] =&quot;Scholey M&quot;
allNames[260] =&quot;Sharp B&quot;
allNames[261] =&quot;Singh C&quot;
allNames[262] =&quot;Skene G&quot;
allNames[263] =&quot;Skinner M&quot;
allNames[264] =&quot;Snowdon R&quot;
allNames[265] =&quot;Sotheran G&quot;
allNames[266] =&quot;Stokes P&quot;
allNames[267] =&quot;Stores&quot;
allNames[268] =&quot;Summers B&quot;
allNames[269] =&quot;Sunda&quot;
allNames[270] =&quot;Sundarajan&quot;
allNames[271] =&quot;Surtees S&quot;
allNames[272] =&quot;Swainston R&quot;
allNames[273] =&quot;Szymonowicz A&quot;
allNames[274] =&quot;Taggart E&quot;
allNames[275] =&quot;Tait A&quot;
allNames[276] =&quot;Tambourrini P&quot;
allNames[277] =&quot;Taylor A&quot;
allNames[278] =&quot;Taylor Tony&quot;
allNames[279] =&quot;Temple G&quot;
allNames[280] =&quot;Test&quot;
allNames[281] =&quot;Thallis C agent&quot;
allNames[282] =&quot;Thomas D&quot;
allNames[283] =&quot;Thomas N&quot;
allNames[284] =&quot;Thompson C&quot;
allNames[285] =&quot;Thompson N&quot;
allNames[286] =&quot;Thompson R W&quot;
allNames[287] =&quot;Thompson S&quot;
allNames[288] =&quot;Tiernan M&quot;
allNames[289] =&quot;Timms I G&quot;
allNames[290] =&quot;Tipton N&quot;
allNames[291] =&quot;Turnbull B&quot;
allNames[292] =&quot;Unknown&quot;
allNames[293] =&quot;Vardy R&quot;
allNames[294] =&quot;Venkadesh K&quot;
allNames[295] =&quot;Vickors G&quot;
allNames[296] =&quot;Villamangna N&quot;
allNames[297] =&quot;Vinton S&quot;
allNames[298] =&quot;Waddacor N&quot;
allNames[299] =&quot;Wade B W&quot;
allNames[300] =&quot;Waistell A&quot;
allNames[301] =&quot;Walsh C N&quot;
allNames[302] =&quot;Ward J&quot;
allNames[303] =&quot;Warin G&quot;
allNames[304] =&quot;Warren D&quot;
allNames[305] =&quot;Warren J&quot;
allNames[306] =&quot;Wasson D&quot;
allNames[307] =&quot;Watson Phil&quot;
allNames[308] =&quot;Webb P&quot;
allNames[309] =&quot;Westcott T&quot;
allNames[310] =&quot;Wheatcroft S&quot;
allNames[311] =&quot;Wheatley P&quot;
allNames[312] =&quot;Whing K&quot;
allNames[313] =&quot;White S&quot;
allNames[314] =&quot;Wiblin T&quot;
allNames[315] =&quot;Wiffin D&quot;
allNames[316] =&quot;Wilkins B&quot;
allNames[317] =&quot;Wilkinson J&quot;
allNames[318] =&quot;Williams D&quot;
allNames[319] =&quot;Wilson B&quot;
allNames[320] =&quot;Wilson K&quot;
allNames[321] =&quot;Wilson P&quot;
allNames[322] =&quot;Workshop&quot;
allNames[323] =&quot;Workshop Office&quot;
allNames[324] =&quot;Wright C&quot;
allNames[325] =&quot;Wright S&quot;
allNames[326] =&quot;Wyatt J&quot;
allNames[327] =&quot;Young E&quot;


//allNames = new Array(&quot;Adam&quot;,&quot;Albert&quot;,&quot;Andrea&quot;,&quot;Bill&quot;,&quot;Barb&quot;,&quot;Betty&quot;,&quot;Chris&quot;,&quot;Carl&quot;)

function loadSelect(letter){
sList = document.getElementById(&quot;mySelect&quot;)
//clear select first
for (x=1; x<sList.options.length; x++){
sList.options[x] = null
}
//now load list
var listCount = 0
for(x=0; x<allNames.length; x++){
if(allNames[x].substr(0,1) == letter){
sList.options[listCount] = new Option(allNames[x], allNames[x])
listCount ++
}
}
}

var alphabet=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;
for(var i=0;i<26;i++){
document.writeln(&quot; <a href=\&quot;javascript:loadSelect('&quot;+alphabet.charAt(i)+&quot;')\&quot;>&quot;+alphabet.charAt(i)+&quot;</a> &quot;+(i!=25?'|':''));
}

</script>
<body onLoad=&quot;loadSelect('A')&quot;>
<form name=&quot;myForm&quot;>
<select multiple size=7 name=&quot;mySelect&quot; id=&quot;mySelect&quot;><option></select>
</form>
<br>
</body>

Many Thanks
Hotlips
 
Thanks for that ... maybe I am nitpicking.. but look at my code and u will see what I mean.... I have had to cut down on the list ...but try click B then try E... the names are mixed.....

<script>
var allNames = new Array();
allNames[0] =&quot;&quot;
allNames[1] =&quot;8t25&quot;
allNames[2] =&quot;Abbott A W&quot;
allNames[3] =&quot;Allport B&quot;
allNames[4] =&quot;Andrews P&quot;
allNames[5] =&quot;Antcliffe D&quot;
allNames[6] =&quot;Apps C&quot;
allNames[7] =&quot;Armstrong D&quot;
allNames[8] =&quot;Ashurst N&quot;
allNames[9] =&quot;Atherton H&quot;
allNames[10] =&quot;Bailey G&quot;
allNames[11] =&quot;Bailey R&quot;
allNames[12] =&quot;Baker G&quot;
allNames[13] =&quot;Baker K&quot;
allNames[14] =&quot;Ball R&quot;
allNames[15] =&quot;Ballantyne J&quot;
allNames[16] =&quot;Bannister D&quot;
allNames[17] =&quot;Bannister F&quot;
allNames[18] =&quot;Bell A&quot;
allNames[19] =&quot;Bell R&quot;
allNames[20] =&quot;Beswick H&quot;
allNames[21] =&quot;Beswick K&quot;
allNames[22] =&quot;Blair J&quot;
allNames[23] =&quot;Blakely&quot;
allNames[24] =&quot;Blakely R&quot;
allNames[25] =&quot;Blundell A&quot;
allNames[26] =&quot;Boyack I&quot;
allNames[27] =&quot;Bradford Stores&quot;
allNames[28] =&quot;Bramhall C&quot;
allNames[29] =&quot;Brannigan J&quot;
allNames[30] =&quot;Bremner A&quot;
allNames[31] =&quot;Brown A&quot;
allNames[32] =&quot;Brown C&quot;
allNames[33] =&quot;Brown H M&quot;
allNames[34] =&quot;Brown I&quot;
allNames[35] =&quot;Brown I R&quot;
allNames[36] =&quot;Budenburg&quot;
allNames[37] =&quot;Bulley P.&quot;
allNames[38] =&quot;Bulmer S&quot;
allNames[39] =&quot;Burdis R&quot;
allNames[40] =&quot;Butcher C&quot;
allNames[41] =&quot;Butler M&quot;
allNames[42] =&quot;Cameron D&quot;
allNames[43] =&quot;Chandon Singh&quot;
allNames[44] =&quot;Chandrasergan V&quot;
allNames[45] =&quot;Chapman J&quot;
allNames[46] =&quot;Cherry S&quot;
allNames[47] =&quot;Chislett R&quot;
allNames[48] =&quot;Clark J&quot;
allNames[49] =&quot;Clarke R&quot;
allNames[50] =&quot;Clarke W A&quot;
allNames[51] =&quot;Clements S&quot;
allNames[52] =&quot;Coblenz E&quot;
allNames[53] =&quot;Coblenz R&quot;
allNames[54] =&quot;Cochran B&quot;
allNames[55] =&quot;Cochrane J&quot;
allNames[56] =&quot;Colley S S&quot;
allNames[57] =&quot;Connel P&quot;
allNames[58] =&quot;Connelly T&quot;
allNames[59] =&quot;Cooper P&quot;
allNames[60] =&quot;Cormac A&quot;
allNames[61] =&quot;Coughlin J&quot;
allNames[62] =&quot;Cowan D&quot;
allNames[63] =&quot;Cowie C&quot;
allNames[64] =&quot;Crane B&quot;
allNames[65] =&quot;Crawford A&quot;
allNames[66] =&quot;Crawley P&quot;
allNames[67] =&quot;Creed S&quot;
allNames[68] =&quot;Creek G&quot;
allNames[69] =&quot;Crichton C&quot;
allNames[70] =&quot;Crogan M&quot;
allNames[71] =&quot;Cunningham W&quot;
allNames[72] =&quot;Cutler H&quot;
allNames[73] =&quot;Dadd A&quot;
allNames[74] =&quot;Dastl E&quot;
allNames[75] =&quot;Davis A C&quot;
allNames[76] =&quot;Davis S&quot;
allNames[77] =&quot;Davison S&quot;
allNames[78] =&quot;Derby&quot;
allNames[79] =&quot;Devlin K&quot;
allNames[80] =&quot;Dew J&quot;
allNames[81] =&quot;Diamond J&quot;
allNames[82] =&quot;Dickson J&quot;
allNames[83] =&quot;Docking F&quot;
allNames[84] =&quot;Dodd D&quot;
allNames[85] =&quot;Domzalski M&quot;
allNames[86] =&quot;Dowds P&quot;
allNames[87] =&quot;Dowell P&quot;
allNames[88] =&quot;Dowling P&quot;
allNames[89] =&quot;Drakelow&quot;
allNames[90] =&quot;Elder J&quot;
allNames[91] =&quot;Farr R&quot;
allNames[92] =&quot;Fay K&quot;
allNames[93] =&quot;Fay P&quot;
allNames[94] =&quot;Fearn A&quot;
allNames[95] =&quot;Fell M&quot;
allNames[96] =&quot;Fenwick N&quot;
allNames[97] =&quot;Foreman W&quot;
allNames[98] =&quot;Fretwell T&quot;
allNames[99] =&quot;Galagher H&quot;
allNames[100] =&quot;Garside M R&quot;
allNames[101] =&quot;Gibson P&quot;
allNames[102] =&quot;Glaze J&quot;
allNames[103] =&quot;Goldshaw S&quot;
allNames[104] =&quot;Goodchild P&quot;
allNames[105] =&quot;Gray D&quot;
allNames[106] =&quot;Greensmith R&quot;
allNames[107] =&quot;Griffin B&quot;
allNames[108] =&quot;Grundy B&quot;
allNames[109] =&quot;Gultig W&quot;
allNames[110] =&quot;Gunning G&quot;
allNames[111] =&quot;Haddock P&quot;
allNames[112] =&quot;Haddow B&quot;
allNames[113] =&quot;Hagan J&quot;
allNames[114] =&quot;Hall M&quot;
allNames[115] =&quot;Halliday S&quot;
allNames[116] =&quot;Hampshire D M&quot;
allNames[117] =&quot;Hannett B&quot;
allNames[118] =&quot;Hardy G&quot;
allNames[119] =&quot;Hari Krishana&quot;
allNames[120] =&quot;Hari Rao Krish&quot;
allNames[121] =&quot;Harpham S&quot;
allNames[122] =&quot;Harrison S.&quot;
allNames[123] =&quot;Harvey TD&quot;
allNames[124] =&quot;Hebburn Stores&quot;
allNames[125] =&quot;Henry Colin&quot;
allNames[126] =&quot;Hensby C&quot;
allNames[127] =&quot;Herbert O&quot;
allNames[128] =&quot;Herrity R&quot;
allNames[129] =&quot;Hewling K&quot;
allNames[130] =&quot;Hill D&quot;
allNames[131] =&quot;Hillman B&quot;
allNames[132] =&quot;Hilyer J&quot;
allNames[133] =&quot;Holdsworth T&quot;
allNames[134] =&quot;Hopkins B&quot;
allNames[135] =&quot;Hughes A&quot;
allNames[136] =&quot;Hughes P&quot;
allNames[137] =&quot;Isaacs S&quot;
allNames[138] =&quot;Jackson M&quot;
allNames[139] =&quot;James R&quot;
allNames[140] =&quot;Jamieson T&quot;
allNames[141] =&quot;Jarnie D&quot;
allNames[142] =&quot;Jones C&quot;
allNames[143] =&quot;Jones G&quot;
allNames[144] =&quot;Jones M.&quot;
allNames[145] =&quot;Jones S&quot;
allNames[146] =&quot;Joyce T&quot;
allNames[147] =&quot;Kamaladoss B&quot;
allNames[148] =&quot;Keigan K&quot;
allNames[149] =&quot;Kemp N&quot;
allNames[150] =&quot;Kesdby&quot;
allNames[151] =&quot;Key M&quot;
allNames[152] =&quot;Kidd M&quot;
allNames[153] =&quot;King B&quot;
allNames[154] =&quot;Kirkley V J&quot;
allNames[155] =&quot;Kirkup S&quot;
allNames[156] =&quot;Kit 23&quot;
allNames[157] =&quot;Kit 24&quot;
allNames[158] =&quot;Kitchen&quot;
allNames[159] =&quot;Klofta E&quot;
allNames[160] =&quot;Klyn M&quot;
allNames[161] =&quot;Knowles J&quot;
allNames[162] =&quot;Laffey L&quot;
allNames[163] =&quot;Laing D&quot;
allNames[164] =&quot;Lamont T&quot;
allNames[165] =&quot;Laws J&quot;
allNames[166] =&quot;Lear S&quot;
allNames[167] =&quot;Leeds Stores&quot;
allNames[168] =&quot;Lenney D&quot;
allNames[169] =&quot;Leyland I&quot;
allNames[170] =&quot;Lindsay N&quot;
allNames[171] =&quot;Livingstone I&quot;
allNames[172] =&quot;Major M&quot;
allNames[173] =&quot;Manufacturer&quot;
allNames[174] =&quot;Marchant M&quot;
allNames[175] =&quot;Marjoram P&quot;
allNames[176] =&quot;Marshall C&quot;
allNames[177] =&quot;Marshall S C&quot;
allNames[178] =&quot;Marsland J&quot;
allNames[179] =&quot;Martin B&quot;
allNames[180] =&quot;Maskell K&quot;
allNames[181] =&quot;Mason J&quot;
allNames[182] =&quot;Mason P&quot;
allNames[183] =&quot;Mc Lean R.&quot;
allNames[184] =&quot;McCabe S&quot;
allNames[185] =&quot;McCollum C J&quot;
allNames[186] =&quot;McDonald D&quot;
allNames[187] =&quot;McGeagh D&quot;
allNames[188] =&quot;McGeough D&quot;
allNames[189] =&quot;McGourley E&quot;
allNames[190] =&quot;McIntyre W&quot;
allNames[191] =&quot;McKenzie C&quot;
allNames[192] =&quot;McKenzie M&quot;
allNames[193] =&quot;McMahon C&quot;
allNames[194] =&quot;McMahon W&quot;
allNames[195] =&quot;McMenamin D&quot;
allNames[196] =&quot;McPhearson K&quot;
allNames[197] =&quot;McQuire B&quot;
allNames[198] =&quot;Meakin P&quot;
allNames[199] =&quot;Miller R&quot;
allNames[200] =&quot;Mitchell T.D&quot;


//allNames = new Array(&quot;Adam&quot;,&quot;Albert&quot;,&quot;Andrea&quot;,&quot;Bill&quot;,&quot;Barb&quot;,&quot;Betty&quot;,&quot;Chris&quot;,&quot;Carl&quot;)

function loadSelect(letter){
sList = document.getElementById(&quot;mySelect&quot;)
//clear select first
for (x=1; x<sList.options.length; x++){
sList.options[x] = null
}
//now load list
var listCount = 0
for(x=0; x<allNames.length; x++){
if(allNames[x].substr(0,1) == letter){
sList.options[listCount] = new Option(allNames[x], allNames[x])
listCount ++
}
}
}

var alphabet=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;
for(var i=0;i<26;i++){
document.writeln(&quot; <a href=\&quot;javascript:loadSelect('&quot;+alphabet.charAt(i)+&quot;')\&quot;>&quot;+alphabet.charAt(i)+&quot;</a> &quot;+(i!=25?'|':''));
}

</script>
<body onLoad=&quot;loadSelect('A')&quot;>
<form name=&quot;myForm&quot;>
<select multiple size=7 name=&quot;mySelect&quot; id=&quot;mySelect&quot;><option></select>
</form>
<br>
</body>

Many Thanks
Hotlips
 
hmmm - seems to like it better when you go backwards...

function loadSelect(letter){
sList = document.getElementById(&quot;mySelect&quot;)
sLength = sList.options.length
//clear select first
for (x=sLength-1; x>0; x--){
sList.options[x] = null
}

//now load list
var listCount = 0
for(x=0; x<allNames.length; x++){
if(allNames[x].substr(0,1) == letter){
sList.options[listCount] = new Option(allNames[x], allNames[x])
listCount ++
}
}
}

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
oopps - forgot a bit (the &quot;=&quot; sign)....

for (x=sLength-1; x>=0; x--){


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Excellent... thanks very much.....can I ask for your help again.....as u can tell I'm knew to javascript....but what I'd like to do now is...
from the list of names I would like to select with the option of say.... maybe only one name or maybe several names... or even all names and built up a criteria string and use this string as the basis of a selection criteria string for a report from a database............. in otherwords.... I select ALL somwhere, or click through the list for 1 name..... or click several names... one after the other ... not in any particular order.... then when selection is complete... submit it in the form of a string back to my database for processing
I would be obliged for you help
Thanks again
Hotlips
 
Are you using ASP to handle the form? If so then your code in your form handler page would look similar to this...

<%
'remember that the selected options will be sent as a comma separated list'
allSelected = split(request(&quot;mySelect&quot;),&quot;,&quot;)

sql = &quot;SELECT * FROM myTable WHERE uName in (&quot;
for x = 0 to uBound(allSelected)
sql = sql & &quot;'&quot; & allSelected(x) & &quot;',&quot;
next
'peel off last comma and add closing parenthesis'
sql = left(sql, len(sql)-1) & &quot;)&quot;

set rs = cn.execute(sql)

%>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
mwolf00,
The script might run a little faster if you use

sList.length=1

instead of

for (x=sLength-1; x>0; x--){
sList.options[x] = null
}


Adam
while(woman.width>woman.height && wallet.value>0){beer++;vision.blur()};
 
Thanks adam, I didn't know that you could remove list items so easily...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top