zoukankan      html  css  js  c++  java
  • JS判断年月

    <!DOCTYPE html>
    <html>
     <head>
      <meta charset="utf-8" />
      <title></title>
      <style type="text/css">
       div{
         300px;
        height: 300px;
        border: 1 solid aqua;
       
       }
      </style>
     </head>
     <body>
       <script type="text/javascript">
        var str  = prompt("请输入一个数");
        var strs  = str.split(" ");
        var y  = parseInt(strs[0]);
        var m = parseInt(strs[1]);
        var max =new  Date(y,m,0).getDate();
        var w = new Date(y +"/"+m +"/"+ "01").getDay();
        var html = '<div class="box">'+
             '<table>'+
              '<tr class ="title"><th colspan ="7">'+y +'年'+m+'月</th></tr>'+
              '<tr><td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td>';
              '<tr>';
           for(var d=1;d<=max; ++d){
            if(w && d==1){
              html+='<td colspan = " ' +w+' "></td>';
            }
                    html +='<td>'+d+'</td>';
          
             if (w==6 && d!=max){
            html += '<tr></tr>';
           }else if ( d==max ){
            html +='</tr>';
           }
           w =(w +1 >6) ? 0:w +1 ;
          }
           html += '</table>';
           html += '</div>';
           
           
           document.write(html);
       </script>
     </body>
    </html>

  • 相关阅读:
    多语言资源文件制作工具
    window service 插件服务插件开发
    .net 中读取自定义Config文件
    Asp.net 主题中CSS文件的缓存问题
    Asp .net 4.0 中ViewStatus 使用
    Linq通用分页数据查询方法
    EF中查询出现死锁的处理
    Windows Live Writer 分享到插件
    Windows Resx资源文件编辑工具
    插件式服务架构
  • 原文地址:https://www.cnblogs.com/weixin2623670713/p/12632313.html
Copyright © 2011-2022 走看看