加个selected
<OPTION value="1" selected>sdff</OPTION>

解决方案 »

  1.   

    不对吧?那当我单击上下尖头选择时,显示在当前SELECT框里的值能被自动选中吗?
      

  2.   

    我的意思是,我列出了1960直2005的数值。<select name="year_mm" size="1" multiple id=select3>
                      <%
      for i=1960 to 2005
      response.Write "<option value="&i&">"&i&"</option>"
      next
      %>
                    </select>SIZE=1,所以SELECT框一次只会显示一条数据,在SELECT框右边会出现一个上下前头进行选择。就是如果,当被选择后的数据显示在SELECT框里,然后自动被选中。不用在单击它。大家试一下,帮帮我,,,急~~~~~~~
      

  3.   

    <select name="year_mm" size="1" multiple id=select3 onclick="setSelected(true)">
                      <%
      for i=1960 to 2005
      response.Write "<option value="&i&">"&i&"</option>"
      next
      %>
    </select>
    <script>
    function setSelected(w) {
    var getyear_mm=document.all.year_mm.options;
    for(i=0;i<getyear_mm.length;i++)
    getyear_mm(i).selected=w;
    }
    </script>点击就能把所有的option选中.
      

  4.   

    to wanghr100(灰豆宝宝.net)谢谢你的帮助。
    但是你那样做,就把所有值全都选择完了。我只要自动选择显示在当前SELECT框里的值。仅仅一个值。该怎么样做呢?
      

  5.   

    Sorry..模拟一下.<select name="year_mm" size="1" multiple id=select3 onselect="alert('selecting')">
                      <%
      for i=1960 to 2005
      response.Write "<option value="&i&">"&i&"</option>"
      next
      %>
    </select>
    <input type=button name="submit" value="<" 
    onmousedown="timer1=setInterval('selectProv()',100)"
    onmouseup="clearInterval(timer1)">
    <input type=button name="submit" value=">" 
    onmousedown="timer2=setInterval('selectNext()',100)"
    onmouseup="clearInterval(timer2)">
    <script>
    function selectNext() {
    n=document.all.year_mm.options.length;
    i=document.all.year_mm.selectedIndex;
    i++;
    if(i<n) document.all.year_mm.selectedIndex=i;
    }function selectProv() {
    n=document.all.year_mm.options.length;
    i=document.all.year_mm.selectedIndex;
    i--;
    if(i>=0) document.all.year_mm.selectedIndex=i;
    }
    </script>
      

  6.   

    今天加班,真让我忙晕了,把JAVASCRIPT脚本都忘了怎么写了...打脸打脸,以后努力学习...哎....最后由衷的谢谢你wanghr100(灰豆宝宝.net) 
    让我今天加班感觉很温暖...
    ~~