Add drop down options after radio button click

H

hust6

I created a form using html, but am having trouble with one issue.

If I user clicks "no" on one of my radio buttons, I want a drop down
selection to appear next to it to display several "reasons" as to why
they chose "no".

How can I implement this?

Thanks in advance for the help!
 
J

Jim

Here you go :
<body >
<form name="myform" action="" method="get">
Would You Buy Our Product?
<input type="radio" name="purchase" value="yes"
onClick="document.forms[0].elements['reasons'].style.display='none'"/>
Yes
<input type="radio" name="purchase" value="no"
onClick="document.forms[0].elements['reasons'].style.display='inline'"/>
No
<select name="reasons" style="display:none" >
<option value="" selected>Please Tell Us Why You Answered 'No'</option>
<option value="not interested">Not Interested</option>
<option value="haveonealready">Have one Already</option>
<option value="tooexpensive">Too Expensive</option>
</select>
<br/><br/>
<input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</form>
</body>
 
T

the DtTvB

Jim said:
<input type="radio" name="purchase" value="yes"
onClick="document.forms[0].elements['reasons'].style.display='none'"/>

If there are any forms before that form, that script won't work.
Try "this.form" instead of "document.forms[0]"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top