js 显示时间

<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>

 

posted @ 2014-04-21 15:36  java狂人  阅读(189)  评论(0编辑  收藏  举报