|
Another question
Hi. Ive got another question. Im trying to change the value of a text input value when a selection is made in a select box (but no button is clicked). I hope this uses the right terminology. My code is below - Does anybody know what Ive done wrong please?
<script type=text/javascript>
function suburb(cityselected) {
var suburbtext=["a","b","c"];
for(i=0; 3) {
if cityselected==[i]{
document.getElementById("suburb").value="Please enter your suburb (e.g"+suburbtext[i]+")";
}
else {
document.getElementById("suburb").value="Please enter your suburb";
}
}
</script>
<select name="city" size=1 style="font-size:14px; font: Calibri; background: #ffffcc; width: 700px" onChange="suburb(this.selectedIndex)">
<option value="">Please select a city</option>
<option value="London">London</option>
<option value="Manchester">Manchester</option>
<option value="Birmingham">Birmingham</option></select>
<input name="suburb" id="suburb" type="text" style="font-size:14px; font: Calibri; background: #ffffcc; width: 700px" maxlength="60">
|