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!

Passing values to a selectedIndex

Status
Not open for further replies.

FreeBASE

Programmer
May 3, 2002
39
0
0
US
Basically here is the problem..

I have a Pulldown (selectedIndex) that looks like this.

<select name=test>
<option value=&quot;AL&quot;>Alabama
<option value=&quot;AK&quot;>Alaska
<option value=&quot;AS&quot;>Am. Samoa

What I a trying to do is pass values from a javascript to the form pulldown (selectedIndex).

# THE CODE #

<script language=&quot;javascript&quot;>
<!--//
function SelectOptions() {
document.theForm.country.selectedIndex = 2; // looksfor the 2nd value
document.theForm.country.selectedIndex = &quot;US&quot;; // doesn't work
}
//-->
</script>



Can someone help me on this? Thanx in advance..
 
are you trying to auto load the options in a sense or are trying to change the values. the question really doesn't make sense. selectedindex is to find out the value that is selected.
admin@onpntwebdesigns.com
 
Auto load the options.. with pre-selected values that the user has chosen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top