求一函数,是关于select选值决定其他控件是否可见的代码
写一单独.js文件
当html页面中,访客在select 选择‘是’时 显示 input1 input2控件
选择 '否 '时 隐藏input1 input2控件
------解决方案-------------------- <form>
<select onchange= "this.options[this.selectedIndex].text== '是 '?input1.style.display=input2.style.display= ' ':input1.style.display=input2.style.display= 'none ' ">
<option value= "1 " selected> 是 </option>
<option value= "0 "> 否 </option>
</select>
<input type= "text " value= "11111111 " id= "input1 " name= "input1 "> <input type= "text " value= "222222222 " id= "input2 " name= "input2 ">
</form>