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);
                               
                       }   
                      
                }
  • 相关阅读:
    IDEA 2018 搭建 Spring MVC helloworld
    Intellij IDEA创建Spring的Hello World项目
    浅谈finally使用坑。
    ArrayList源码分析
    Spring依赖注入的四种方式(重点是注解方式)
    Spring常用的三种注入方式
    interview question
    待提高问题
    myeclipse svn 在线安装
    《SQL 进阶教程》 自连接排序
  • 原文地址:https://www.cnblogs.com/gwazy/p/126331.html
Copyright © 2011-2022 走看看