simplyblue
09-05-2002, 10:12 AM
Hi,
Is there a way to default select a value in a drop down list in javascript?
I have a form which contains user information. It's for users to update their information. One of the field, country, is a drop-down list containing all the countries. Default selection has to be the value read from the database.
This is what I have,
<Select name=country >
<script>
document.form.country.options[<%=rs("ccountry")%>].selected='true'
</script>
<option value=AF >Afghanistan
<option value=AL >Albania
.......
</select>
But it doesn't work! Anyone can help? Thanks!
Is there a way to default select a value in a drop down list in javascript?
I have a form which contains user information. It's for users to update their information. One of the field, country, is a drop-down list containing all the countries. Default selection has to be the value read from the database.
This is what I have,
<Select name=country >
<script>
document.form.country.options[<%=rs("ccountry")%>].selected='true'
</script>
<option value=AF >Afghanistan
<option value=AL >Albania
.......
</select>
But it doesn't work! Anyone can help? Thanks!