[Javascript] Positioning within a select box

Ben ben at babelfish.co.uk
Tue Mar 20 16:05:43 CST 2001


> Greetings, list...
>
> I have a list of about 30 or so languages to choose from in a select box,
> from Arabic to Thai.  Since the list is alphabetized, when the
> page pops up,
> Arabic is the top selection.  What I want to do is position the
> display such
> that English, the 9th language in the list, is the top selection.
>  How can I
> do this?
>
> Regards,
>    -Mark C.

Mark.  Did you want English at the top of the list or just to be automaticly
selected when the page loads?  If you want it at the top of the list then
put the English <option> entry directly after the opening <select> tag.  If
you want English to be automaticly selected then add the "selected"
attribute to the English <option> tag, like this:

	<option selected>English</option>

I recommend pre-selecting ov er re-ordering, but this can sometimes offend
non-English-based visitors to the site.

Hope this helps.

 .b





More information about the Javascript mailing list