当前位置: 代码迷 >> JavaScript >> JavaScript中写入时间上拉列表
  详细解决方案

JavaScript中写入时间上拉列表

热度:75   发布时间:2012-10-15 09:45:25.0
JavaScript中写入时间下拉列表
<script type="text/javascript">
  function writeOptions(starttime,endtime)
            {
      
      var counter;
  for(counter=starttime;counter<=9;counter++)
  {
 
  document.write("<option value=0"+counter+">"+"0"+counter);
   
  }
 
  for(counter=10;counter<=endtime;counter++)
  {
 
  document.write("<option value="+counter+">"+counter);
 
 
  }
 
  }
 
 
  </script>
<td>
<select name="startselecttime_hh" style="width:expression((this.offsetWidth>40)?'auto':'40')">
    <script>
   writeOptions(0,23); 
   </script>       
    </select><a>时</a>
<td>
<td>
<select name="startselecttime_mm" style="width:expression((this.offsetWidth>40)?'auto':'40')">
    <script>
   writeOptions(0,59); 
   </script>       
    </select><a>分</a>
<td>
<script type="text/javascript">
var startselecttime_hh=document.getElementById("startselecttime_hh");
for (i=0;i<startselecttime_hh.length;i++){    
        
if(starttime_hh==startselecttime_hh.options[i].value){
                                                                                                     
startselecttime_hh.options[i].selected=true;
}

    }[/color][color=brown]
</script>
  相关解决方案