hanxuming

————————————————

<script type="text/javascript">        
            function start(){                
                setInterval(function(){
                    var now = new Date();
                    var m = now.getMonth() + 1;
                    var d = now.getDate();
                    var str = \'\';
                    str += now.getYear() + 1900 + \'年\';
                    str += now.getMonth() + 1 + \'月\';
                    str += now.getDate() + \'日\';
                    str += now.getHours() + \'时\';
                    str += now.getMinutes() + \'分\';
                    str += now.getSeconds() + \'秒\';                    
                    if(now.getDay() >= 5){
                        str += \',今天是周末\';
                    }else if(m==1 && d==1)
                        str += \',今天是周末\';
                    else if(m==5 && d==1)
                        str += \',今天是劳动节\';
                    else if(m==10 && d==1)
                        str += \',今天是国庆节\';
                    else
                        str += \',今天不是节假日\';
                    document.getElementById(\'left\').innerHTML = str;
                },1000);
            }
        </script>

————————————————————————

<body style="text-align:center">
        <p>            
            <input type="button" value="查看今天是否节假日" onclick="start();"/>
        </p>
        <h2 id="left"></h2>        
    </body>

————————————————————————

分类:

技术点:

相关文章: