如果用户选择“房屋”,我希望弹出一个新的选择选项框。目前没有任何事情发生。
function showFamilies(){
if(pt.selectedIndex == 1)
document.getElementById('families').style.display = 'block';
if(pt.selectedIndex != 1)
document.getElementById('families').style.display = 'none';
}
<select id="pt" value="pt" name="pt" onChange="showFamilies()">
<option value="" name="">Select</option>
<option value="1" name="1">House</option>
<option value="2" name="2">Commercial</option>
</select>
<div id="families" style="display:none">Families:
<select name="amin_families">
<option value="1" name="Condo">1</option>
<option value="2" name="Co-Op">2</option></select>
</div>