实现下拉列表单个option的disabled

<style type="text/css">
option.disabled { color: #999;}
</style>
        
<sript type="text/javasript">
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;
}
</sript>
        <tr>
          <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="3">
                <tr>
                  <td width="58%" align="right">
                   <select name="type" class="textinput" 
        onchange='return preventSelectDisabled(this)'>
       <option value="1">文章标题</option>
       <option value="2" disabled='disabled' class='disabled'>文章内容</option>
       <option value="3">全文搜索</option>
                    </select>

 

你可能感兴趣的:(css)