zoukankan      html  css  js  c++  java
  • 初始化时间下列框的脚本

    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);
    }

  • 相关阅读:
    Django and Djangorestframework
    安装socketio出现module 'importlib._bootstrap' has no attribute 'SourceFileLoader' 错误
    pycharm 里运行 django 工程 You must either define the environment variable DJANGO_SETTINGS_MODULE 错误
    linux 安装python3
    iOS 10.3下解决Fiddler代理抓包ssl证书信任问题
    Android 7.0 fiddler代理抓不到https请求的解决办法
    python base64 decode incorrect padding错误解决方法
    Fiddler做代理服务器时添加X-Forwarder-For转发真实客户端ip
    python安装pbkdf2 遇到错误TypeError: __call__() takes exactly 2 arguments (1 given)
    soapUI通过groovy脚本设置超时时间
  • 原文地址:https://www.cnblogs.com/liubiqu/p/140188.html
Copyright © 2011-2022 走看看