Page 1 of 1

automatically move to first letter of selection on list

Posted: Wed Mar 05, 2008 12:10 am
by controlxjp
hi everyone,

this might be very elementary, but i can't seem to find where,

would this be javascript, i think i found a page implementing this but saw no onclick event
for the list element

would anyone mind pointing me in the right direction of this search? thanks


-->

drop down list of countries -




sorry i had to move my post, i just noticed there's a clientside area for this forum, which i did not notice earlier because i always automatically get shifted to the php portion
if i pressed r
the selected item automatically moves to the first item in the list with r as its first letter


thanks

Re: automatically move to first letter of selection on list

Posted: Thu Mar 06, 2008 4:04 pm
by Chalks
I don't think I understand the question. Do you mean something like this?

Code: Select all

<select name="option">  <option value="uk">UK</option>  <option value="france">France</option>  <option value="usa" selected="selected">USA</option>  <option value="australia">Australia</option></select>
too add javascript functionality on a selection change, use this:

Code: Select all

<select name="option" onchange="YourJavaScriptFunction(this.options[this.selectedIndex].value)">  <option value="uk">United Kingdom</option>  <option value="france">France</option>  <option value="usa" selected="selected">USA</option>  <option value="australia">Australia</option></select>
it will send to the function YourJavaScriptFunction() the "countryname" (in the option tag, not the plain text... ie 'uk' would be sent, not 'united kingdom').