zoukankan      html  css  js  c++  java
  • js 每个月有多少天算法

    function change_date ()
                {
                  
    var month=document.getElementById('start_month');
                  
                    
    var  month_temp=month.value.split('月');
                   
    var  year=document.getElementById('start_year') ;
                   
    var year_temp=year.value.split('年');
                   
    var date ;
                    
    if (month_temp[0]=='1'|| month_temp[0]=='3'|| month_temp[0]=='5|| month_temp[0]=="7" || month_temp[0]=="8"  || month_temp[0]=="10"   || month_temp[0]=="12" )
                     {  date
    =31 ;
                      }
                      
    if (month_temp[0]=='4|| month_temp[0]=='6'   || month_temp[0]=='9 '  || month_temp[0]=='11' )
                      {
                      date
    =30;
                      }
                     
    //  window.alert (month_temp[0]);
                     
                      
    if (month_temp[0]=='2' )
                      { 
                        
    if(year_temp[0]%100==0)
                        { 
                          
    if (year_temp[0]%400==0)
                             {
                               date
    =29 ;
                             }
                             
    else
                             {
                            date
    =28;
                              }
                              
                        } 
                        
    else
                        {
                           
    if(((year_temp[0]%100)%4)==0)
                              {
                               date
    =29 ;
                              }
                              
    else
                              {  
                                date
    =28;
                              } 
                         }  
                      }
                      
                        
    var temp_date =document.getElementById('start_day');
                     
    for(i=1;i<date;i++)
                     {
                          
    var add_date=document.createElement("OPTION");
                            add_date.text
    =i+'日';
                            add_date.value
    =i+'日';
                            temp_date.add(add_date);
                               
                       }   
                      
                }
  • 相关阅读:
    软键盘的监听
    获取视频播放时长
    安装hue及hadoop和hive整合
    Centos6.5使用yum安装mysql——快速上手必备(转载)
    Hadoop yarn任务调度策略介绍(转)
    CentOS下RPM方式安装MySQL5.6(转载)
    exists,in的区别-mysql
    CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解决方法
    SpringMVC+Apache Shiro+JPA(hibernate)案例教学(四)基于Shiro验证用户权限,且给用户授权
    SpringMVC+Apache Shiro+JPA(hibernate)案例教学(三)给Shiro登录验证加上验证码
  • 原文地址:https://www.cnblogs.com/gwazy/p/126331.html
Copyright © 2011-2022 走看看