• 初始化时间下列框的脚本


    var oStartTime = new Date(2003,12,12,7,0);
            
    var oEndTime = new Date(2003,12,12,23,0);
            
    //初始化开始时间和结束时间
            var oSelect = document.all("cboStartTime");
            
    var oEndSelect = document.all("cboEndTime");
            
    var oTime = new Date();
            
    for(var i= 0;oStartTime<oEndTime;i++)
            {
                
    var iCount = 15 * i;
                
    //alert("Current setting is " + oStartTime.toLocaleString() + "  i=" + i + "  iCount=" + iCount + "  strValue=" + strValue );
                oStartTime = new Date(2003,12,12,7,0);
                oStartTime.setMinutes(iCount);
                
    var strValue = oStartTime.getHours() + ":" + oStartTime.getMinutes();
                
    //alert("Current setting is " + oStartTime.toLocaleString() + "  i=" + i + "  strValue=" + strValue );
                var oOption = document.createElement("OPTION");
                oOption.text 
    = strValue;
                oOption.value 
    = strValue;
                
    if(oStartTime.getHours() == oTime.getHours() && oStartTime.getMinutes() == 0)
                oOption.selected 
    = true;
                oSelect.add(oOption);
                
    var oOption1 = document.createElement("OPTION");
                oOption1.text 
    = strValue;
                oOption1.value 
    = strValue;
                
    if(oStartTime.getHours() == (oTime.getHours()+1&& oStartTime.getMinutes() == 30)
                oOption1.selected 
    = true;
                oEndSelect.add(oOption1);
            }




    我原来的写法:
    var oStartTime = new Date(2003,12,12,7,0);
      var oEndTime = new Date(2003,12,12,23,0);
      //初始化开始时间和结束时间
      var oSelect = document.all("cboStartTime");
      var oEndSelect = document.all("cboEndTime");

      var oTime = new Date();
      for(var i= 0;oStartTime<oEndTime;i++)
      {
       oStartTime.setMinutes(15*i);
       var strValue = oStartTime.getHours() + ":" + oStartTime.getMinutes();
       //alert("Current setting is " + oStartTime.toLocaleString() + "  i=" + i + "  strValue=" + strValue );
       var oOption = document.createElement("OPTION");
       oOption.text = strValue;
       oOption.value = strValue;
       oSelect.add(oOption);
       var oOption1 = document.createElement("OPTION");
       oOption1.text = strValue;
       oOption1.value = strValue;
       oEndSelect.add(oOption1);
    }

  • 相关阅读:
    对vector等STL标准容器的排序操作
    Security log is full,only administrator can log on to fix the problem(安全日志满了)
    Linux vi 中搜索关键字
    Linux tar 解压缩命令
    max_size, capacity and size 的区别
    四个基数任意次数组合相加得到一个数N,求所有可能组合
    robot framework 笔记(三),RF安装
    电脑重装后 python 2 3快速安装
    python练习题(四)
    apscheduler 执行报错No handlers could be found for logger "apscheduler.executors.default
  • 原文地址:https://www.cnblogs.com/liubiqu/p/140188.html
Copyright © 2020-2023  润新知