Click to See Complete Forum and Search --> : Dropdown Menu, document.write("XX") on selecting an option


richiet85
11-21-2003, 12:01 PM
hi i have this dropdown menu when you select an option i would like a value written in the textbox, heres the code

<form name="Prefix">Select Your Country
<select name="prefix">
<option>UK</option>
<option>USA</option>
</select>
<br><br>
Your Countries Prefix Is <input name="code" type="textbox" size="4">
</form>

when you select UK i would like +44 printed in textbox
and US +1 this would be a great help and would be much appreciated if anyone could help me out thanks

pyro
11-21-2003, 12:07 PM
<form name="Prefix" action="">
<p>Select Your Country
<select name="prefix" onchange="this.form.code.value=this.options[this.selectedIndex].value;">
<option value="">Choose</option>
<option value="+44">UK</option>
<option value="+1">USA</option>
</select></p>
<p>Your Countries Prefix Is <input name="code" type="textbox" size="4"></p>
</form>

richiet85
11-21-2003, 12:19 PM
thank you kindly works a treat :D :D :D

pyro
11-21-2003, 12:27 PM
You are very welcome. :)

richiet85
11-21-2003, 12:40 PM
one mroe thing sorry lol

i have found a site which lists all countries and their prefixes, does anybody know where i can get this sort of list which is already in a dropdown menu? because it would save me lots of time rather than having to enter each option individually

Thanks
http://globaltelecom.org/codes_ab.htm