select 滚动条位置
下面的select,如何实现在画面显示时,将滚动条正好定位到显示出6的位置
<select name= "test " size= "3 " multiple= "MULTIPLE " id= "test ">
<option value= "a "> 1 </option>
<option value= "b "> 2 </option>
<option value= "c "> 3 </option>
<option value= "d "> 4 </option>
<option value= "e "> 5 </option>
<option value= "f " selected> 6 </option>
<option value= "g "> 7 </option>
<option value= "h "> 8 </option>
</select>
------解决方案--------------------你把multiple= "MULTIPLE "这个去掉试试
------解决方案-------------------- <body onload= "SetPos() ">
<script>
function SetPos()
{
s = document.getElementById( "test ")
for(i = 0;i <s.length;i++)
{
if(s[i].text == "6 ") s[i].selected=true
}
}
</script>
<select name= "test " size= "3 " multiple= "MULTIPLE " id= "test ">
<option value= "a "> 1 </option>
<option value= "b "> 2 </option>
<option value= "c "> 3 </option>
<option value= "d "> 4 </option>
<option value= "e "> 5 </option>
<option value= "f "> 6 </option>
<option value= "g "> 7 </option>
<option value= "h "> 8 </option>
</select>
------解决方案--------------------把size改成 6 不就可以了么