js 显示时间

来源:互联网 发布:广通网络 编辑:程序博客网 时间:2024/06/06 03:16
<div class="date">
                <script language="JavaScript">
                         today=new Date();
                         function initArray(){
                         this.length=initArray.arguments.length
                         for(var i=0;i<this.length;i++)
                         this[i+1]=initArray.arguments[i]}
                         var d=new initArray(
                         "周日","周一","周二","周三","周四","周五","周六");
                         if(document.all){
                             if(10>today.getMinutes()){
                                 document.write(today.getYear()+"-"+(today.getMonth()+1)+"-"+today.getDate()+"&&nbsp;"+today.getHours()+":0"+ today.getMinutes()+"&nbsp;&nbsp;"+d[today.getDay()+1]);
                             }else{
                                 document.write(today.getYear()+"-"+(today.getMonth()+1)+"-"+today.getDate()+"&nbsp;"+today.getHours()+":"+ today.getMinutes()+"&nbsp;&nbsp;"+d[today.getDay()+1]);
                             }
                         }else{
                             if(10>today.getMinutes()){
                                 document.write((today.getYear()+1900)+"-"+(today.getMonth()+1)+"-"+today.getDate()+"&nbsp;"+today.getHours()+":0"+ today.getMinutes()+"&nbsp;&nbsp;"+d[today.getDay()+1]);
                             }else{
                                 document.write((today.getYear()+1900)+"-"+(today.getMonth()+1)+"-"+today.getDate()+"&nbsp;"+today.getHours()+":"+ today.getMinutes()+"&nbsp;&nbsp;"+d[today.getDay()+1]);
                              }
                         }
                     </script>
            </div>
0 0
原创粉丝点击