大家知道, 對於HTML控件select, 是沒有readOnly屬性的,
所以設置它並不起作用,如:

1記憶:如何禁止select控件選擇<select id="select1" readonly="readonly">
2記憶:如何禁止select控件選擇<option value="aa">aa</option>
3記憶:如何禁止select控件選擇<option value="bb">bb</option>
4記憶:如何禁止select控件選擇<option value="cc">cc</option>
5記憶:如何禁止select控件選擇<option value="dd">dd</option>
6記憶:如何禁止select控件選擇</select>
7記憶:如何禁止select控件選擇

如果用disabled的話,提交時又取不到值.
那麼有什麼方法可以實現?
----我現在還沒找到 -_-!
不過可以有一個折中的方法,如下:

1記憶:如何禁止select控件選擇<select id="select1" onfocus="this.defOpt=this.selectedIndex" onchange="this.selectedIndex=this.defOpt;">
2記憶:如何禁止select控件選擇    <option value="aa">aa</option>
3記憶:如何禁止select控件選擇    <option value="bb">bb</option>
4記憶:如何禁止select控件選擇    <option value="cc" selected>cc</option>
5記憶:如何禁止select控件選擇    <option value="dd">dd</option>
6記憶:如何禁止select控件選擇</select>
7記憶:如何禁止select控件選擇

這樣就搞定了.呵呵.
 

相关文章: