让select只读
<select id=demo initValue=1 onchange=selectedIndex=initValue>
<option>1
<option selected>2
<option>3
</select>
<input type=button onclick=sel(0) value=1>
<input type=button onclick=sel(1) value=2>
<input type=button onclick=sel(2) value=3>
<script>
function sel(n){with(demo)selectedIndex=initValue=n;}
</script>
<select id=demo initValue=1 onchange=selectedIndex=initValue>
<option>1
<option selected>2
<option>3
</select>
<input type=button onclick=sel(0) value=1>
<input type=button onclick=sel(1) value=2>
<input type=button onclick=sel(2) value=3>
<script>
function sel(n){with(demo)selectedIndex=initValue=n;}
</script>
不过对不起,可能我没有说清楚.
我的需求是select,初始华的时候可以选择,选择一遍后,我就让不选(不可以选别的值)了,但是要把值列在那里,不能disable.
请帮我再看看。
<input type=hidden name=mysele value="">
<select id=demo initValue=1 onchange="this.form.mysele.value=this.value;this.disabled=true;">
<option value="">请选择</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
</select>
<form>
<select id=demo onchange="if(f){selectedIndex=initValue;}else{f=true;}">
<option>1
<option>2
<option>3
</select>
<input type=button onclick=sel(0) value=1>
<input type=button onclick=sel(1) value=2>
<input type=button onclick=sel(2) value=3>
<script>
var initValue;
var f;
function sel(n){
with(demo)selectedIndex=initValue=n;
}
</script>
disabled=true