nikko50
01-19-2006, 04:37 PM
How can I change a select list depending what a user types in a text box?
I'm just trying to grab the first 10 charactors of the text field and see if they match a particular string and then change the select list if they do.
<script>
function selectOption(oTxt){
var sel = oTxt.form.selName;
if (oTxt.value.substring(0,9)== "1Z9R29A403"){
//MAKE SELECT LIST CHANGE TO VALUE "01" WHICH IS UPS NEXT DAY
}
}
</script>
<form method="POST" onSubmit="return false" >
<p><input type="text" name="id" size="20" onkeyup="selectOption(this)" onblur="selectOption(this)"></p>
<p><select size="1" name="selName">
<option value="01">UPS NEXT DAY</option>
<option value="02">UPS SECOND DAY</option>
<option value="03">UPS GROUND</option>
<option value="" selected>Select One</option>
</select></p>
</form>
I'm just trying to grab the first 10 charactors of the text field and see if they match a particular string and then change the select list if they do.
<script>
function selectOption(oTxt){
var sel = oTxt.form.selName;
if (oTxt.value.substring(0,9)== "1Z9R29A403"){
//MAKE SELECT LIST CHANGE TO VALUE "01" WHICH IS UPS NEXT DAY
}
}
</script>
<form method="POST" onSubmit="return false" >
<p><input type="text" name="id" size="20" onkeyup="selectOption(this)" onblur="selectOption(this)"></p>
<p><select size="1" name="selName">
<option value="01">UPS NEXT DAY</option>
<option value="02">UPS SECOND DAY</option>
<option value="03">UPS GROUND</option>
<option value="" selected>Select One</option>
</select></p>
</form>