本文主要是介绍使下拉框某项不可选的方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
2008年02月22日 02:24 P.M.
<html> <head> <style type="text/css"> option.disabled { color: #999;} </style> <script> function preventSelectDisabled(oSelect) { var isOptionDisabled = oSelect.options[oSelect.selectedIndex].disabled; if(isOptionDisabled) { oSelect.selectedIndex = oSelect.defaultSelectedIndex; return false; } else oSelect.defaultSelectedIndex = oSelect.selectedIndex; return true; } </script> </head> <body> <select name="Type" id="ReportName" class="textinput" οnchange='return preventSelectDisabled(this)'> <option value="reportAsset"> Positions Summary </option> <option value="reportOptions"> Account Transactions </option> <option value="reportOptions"> Performance Summary </option> <option disabled='disabled' class='disabled'> Asset Allocations </option> <option disabled='disabled' class='disabled'> Options Tracking </option> <option disabled='disabled' class='disabled'> Historical Variance </option> <option disabled='disabled' class='disabled'> Portfolio Statistics </option> </select> </body> |
这篇关于使下拉框某项不可选的方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!