I need to make a form with a few options could be radio or drop down, ex a, b, and c..
and when one is selected I would have a if command that would give you another set of options like if option "a" is selected then in the same page would come up another set of options like a1, a2, a3.. or if "b" is selected then options b1, b2, b3 and so on..

thanks for the help..


<select name="select1" id="select1" onChange="return changeForm();">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<select name="select2" id="select2">


function changeForm(){
var a = document.getElementById("select1");
var b = document.getElementById("select2");
var c = a.options[a.selectedIndex].value;
if(c == 1){
b.innerHTML = '<option value="1.1">1</option><option value="1.2">2</option>';
if(c == 2){
b.innerHTML = '<option value="2.1">1</option><option value="2.2">2</option>';
if(c == 3){
b.innerHTML = '<option value="3.1">1</option><option value="3.2">2</option>';

so all I have to do is put the form values i want for the 2nd set of options in the b.innerHTML field?


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.