Drop_down selected form
select form from drop down list value
by vaheed akhtar
HTML
<body onload="hidefield()">
<select name="travel_arriveVia" id="travel_arriveVia" onchange="showfield(this.options[this.selectedIndex].value)">
<option selected="selected">Please select ...</option>
<option value="Plane">Plane</option>
<option value="Train">Train</option>
<option value="Own Vehicle">Own Vehicle</option>
<option value="Other">Other</option>
</select>
<div id="div1">If Other: <input type="text" name="whatever" /></div>
<div style="border:2px solid grey" id="wl">
<p>Welcome</p>
<p>Welcome</p>
<p>Welcome</p>
</div>
</body>
JavaScript
function showfield(name){
if(name=='Other')document.getElementById('div1').style.display="block";
else if(name=='Train')document.getElementById('wl').style.display="block";
else document.getElementById('div1').style.display="none";
}
function hidefield() {
document.getElementById('div1').style.display='none';
document.getElementById('wl').style.display='none';
}