i can be display one row by selecting value from drop down box BUT ALSO i need to display 2 rows by selecting value from drop down box of textbox's and radio button,drop down box using this code
<html> <head> <title>Dynamic Form</title> <script type="text/javascript" > function refresh() { location.reload(); } function CreateTextbox() { var b=document.form.drop.value; var html = "<table id='table1'><tbody><tr><td><td><td><td>NAME</td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>AGE</td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>GENDER</td><td><td><td><td><td><td><td><td><td><td>BERTH</td><td><td><td><td><td><td><td><td><td><td><td><td>SENIOR CITEZEN</td></tr></tbody></table>"; document.getElementById('div1').innerHTML = html; var tr = document.createElement('tr'); var td = document.createElement('td'); //td.innerHTML = 'ABC'; tr.appendChild(td); var s = tr.innerHTML; tr.innerHTML = s; if(b==1) { tr.innerHTML = '<td><td><td><td>' + "<input type=text name='name1' placeholder='n'/>" +'<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type=text name='age' placeholder='a'/>"+'<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type='radio' name='gen' value='male' />"+"MALE"+'<td>'+"<input type='radio' name='gen' value='male' />"+"FEMALE"+ '<td><td><td><td><td><td><td><td><td>'+"<select> <option value='lb'>Lower Berth</option><option value='up'>upperberth</option> <option value='ws'>window seat</option> <option value='nc'>no choice</option> </select>"+'<td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type='checkbox' name='sen' onclick='val()'+i/>"+'</td>'; var tbody = document.getElementById('table1').getElementsByTagName('tbody')[2]; tbody.appendChild(tr); } else if(b==2) { tr.innerHTML = '<td><td><td><td>' + "<input type=text name='name1' placeholder='n'/>" +'<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type=text name='age' placeholder='a'/>"+'<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type='radio' name='gen' value='male' />"+"MALE"+'<td>'+"<input type='radio' name='gen' value='male' />"+"FEMALE"+ '<td><td><td><td><td><td><td><td><td>'+"<select> <option value='lb'>Lower Berth</option><option value='up'>upperberth</option> <option value='ws'>window seat</option> <option value='nc'>no choice</option> </select>"+'<td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type='checkbox' name='sen' onclick='val()' +i/>"+'</td>'; var tbody = document.getElementById('table1').getElementsByTagName('tbody')[0]; tbody.appendChild(tr); } else if(b==3) { tr.innerHTML = '<td><td><td><td>' + "<input type=text name='name1' placeholder='n'/>" +'<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type=text name='age' placeholder='a'/>"+'<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type='radio' name='gen' value='male' />"+"MALE"+'<td>'+"<input type='radio' name='gen' value='male' />"+"FEMALE"+ '<td><td><td><td><td><td><td><td><td>'+"<select> <option value='lb'>Lower Berth</option><option value='up'>upperberth</option> <option value='ws'>window seat</option> <option value='nc'>no choice</option> </select>"+'<td><td><td><td><td><td><td><td><td><td><td><td>'+"<input type='checkbox' name='sen' onclick='val()'+i/>"+'</td>'; var tbody = document.getElementById('table1').getElementsByTagName('tbody')[0]; tbody.appendChild(tr); } else { alert("asds"); } } </script> </head> <body> <form name="form" action="post" method=""> <input type="button" value="REFRESH" onclick='refresh()' > <select name="drop" onchange='CreateTextbox()'> <option value="-1">select</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option></select> <div id="div1"> </div> </form> </body> </html> please help me guys
Ads