Nonyabusiness
New member
So when someone click the radio button "Seattle" or "New York" i want a text to appear in the text box. So if they click Seattle, "The west coast" appears and when they click New York, "The east coast appears in the text box.
This is what i have so far...
<form action="">
<p>Tell me about yourself, what city do you prefer?</p>
<input type="radio" onclick="changeText(this)" name="radio" value="0"/>Seattle
<input type="radio" onclick="changeText(this)" name="radio" value="1"/>New York
<input type="text" name="city" />
</form>
<script type="text/javascript">
var text=new Array("The west coast" , "The east coast");
function changeText(radio)
{
document.getElementById( 'text').value = "" + text[radio.value];
}
</script>
How do i get it to work?
This is what i have so far...
<form action="">
<p>Tell me about yourself, what city do you prefer?</p>
<input type="radio" onclick="changeText(this)" name="radio" value="0"/>Seattle
<input type="radio" onclick="changeText(this)" name="radio" value="1"/>New York
<input type="text" name="city" />
</form>
<script type="text/javascript">
var text=new Array("The west coast" , "The east coast");
function changeText(radio)
{
document.getElementById( 'text').value = "" + text[radio.value];
}
</script>
How do i get it to work?