本文介绍了下拉值没有变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 过渡//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > < html xmlns =" http://www.w3.org/1999/xhtml" > < 头部 > < 元 http-equiv =" Content-Type" 内容 =" text/html; charset = iso-8859-1" / > < 标题 > 无标题文档< /title > < 脚本 类型 =" 文本/javascript" > 函数doClick(objRad){ 如果(objRad.value =="rent"){ document.getElementById("rent").style.display ='block'; document.getElementById("buymin").style.display ='none'; document.getElementById("buymax").style.display ='none'; //显示其他选项 } } < /script > < /head > < 正文 > < 输入 =" radio" 名称 =" rad" 值 =" 购买" onclick =" doClick(this);" > < b > BUY < /b > < 输入 =" radio" 名称 =" rad" 值 =" RENT" onclick =" doClick(this);" > < b > RENT < /b > < p > 预算< /p > < 选择 类 =" min" id =" 购买" > < 选项 > Min < /option > < 选项 > 5Lakhs < /option > < 选项 > 10Lakhs < /option > < 选项 > 20Lakhs < /option > < 选项 > 25Lakhs < /option > < 选项 > 30Lakhs < /option > < 选项 > 35Lakhs < /option > < 选项 > 40Lakhs < /option > < 选项 > 45Lakhs < /option > < 选项 > 50Lakhs < /option > < /select > < span =" position:relative; top:6px; left:10px; color: #FFFFFF" > To < /span > < 选择 id =" buymax" class =" max" " >> ; < 选项 > Max < /option > < 选项 > 10Lakhs < /option > < 选项 > 30Lakhs < /option > < 选项 > 40Lakhs < /option > < 选项 > 50Lakhs < /option > < 选项 > 60Lakhs < /option > < 选项 > 70Lakhs < /option > < 选项 > 80Lakhs < /option > < 选项 > 90Lakhs < /option > < 选项 > 1crore < /option > < /select > < 选择 id =" rent" 样式 =" 显示:无" 类 =" 最小" > < 选项 > MinRent < /option > < 选项 > 5000 < /option > < 选项 > 8000 < /option > < 选项 > 10000 < /option > < 选项 > 15000 < /option > < 选项 > 20000 < /option > < 选项 > 30000 < /option > < 选项 > 35000 < /option > < 选项 > 45000 < /option > < 选项 > 50000 < /option > < 选项 > 60000 < /option > < 选项 > 1Lakh < /option > < /select > < span =" position:relative; top:6px; left:10px; color: #FFFFFF" > To < /span > < 选择 id =" rent" 样式 =" 显示:无" 类 =" 最大值" > < 选项 > MaxRent < /option > < 选项 > 10000 < /option > < 选项 > 15000 < /option > < 选项 > 20000 < /option > < 选项 > 25000 < /option > < 选项 > 30000 < /option > < 选项 > 35000 < /option > < 选项 > 45000 < /option > < 选项 > 50000 < /option > < 选项 > 1 Lakh < /option > < 选项 > 1Lakh + < /option > < /select > < /body > < /html >
解决方案
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript"> function doClick(objRad){ if (objRad.value=="rent"){ document.getElementById("rent").style.display='block'; document.getElementById("buymin").style.display='none'; document.getElementById("buymax").style.display='none'; //show other options } } </script> </head> <body> <input type="radio" name="rad" value="BUY" onclick="doClick(this);" ><b>BUY</b> <input type="radio" name="rad" value="RENT" onclick="doClick(this);" ><b>RENT</b> <p>Budget</p> <select class="min" id="buymin"> <option >Min</option> <option>5Lakhs</option> <option>10Lakhs</option> <option>20Lakhs</option> <option>25Lakhs</option> <option>30Lakhs</option> <option>35Lakhs</option> <option>40Lakhs</option> <option>45Lakhs</option> <option>50Lakhs</option> </select> <span style="position:relative; top:6px; left:10px; color:#FFFFFF">To</span> <select id="buymax"class="max"> <option>Max</option> <option>10Lakhs</option> <option>30Lakhs</option> <option>40Lakhs</option> <option>50Lakhs</option> <option>60Lakhs</option> <option>70Lakhs</option> <option>80Lakhs</option> <option>90Lakhs</option> <option>1crore</option> </select> <select id="rent" style="display:none" class="min"> <option >MinRent</option> <option>5000</option> <option>8000</option> <option>10000</option> <option>15000</option> <option>20000</option> <option>30000</option> <option>35000</option> <option>45000</option> <option>50000</option> <option>60000</option> <option>1Lakh</option> </select> <span style="position:relative; top:6px; left:10px; color:#FFFFFF">To</span> <select id="rent" style="display:none" class="max"> <option>MaxRent</option> <option>10000</option> <option>15000</option> <option>20000</option> <option>25000</option> <option>30000</option> <option>35000</option> <option>45000</option> <option>50000</option> <option>1 Lakh</option> <option>1Lakh +</option> </select> </body> </html>
解决方案
这篇关于下拉值没有变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!