时间控件中默认是当前时间,改成默认时间到上个月;

function lastTime(){
            var lastTime=new Date();
            var h=lastTime.getFullYear();
            var m=lastTime.getMonth();
           
          if(m==0){
              h=h-1;
              m=12;
          }
            m= m<10?"0"+m:m; 
            return h+""+m;
        };
        $(document).ready(function() {

//此处把时间赋值到你设置的value中
            document.getElementById("realMonth").value = lastTime();
        });
        
        </script>

猜你喜欢

转载自blog.csdn.net/qq_41834408/article/details/82787268
今日推荐