jquery 年月日星期是分秒 時鐘--搜集

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="jqgrid_Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>未命名頁面</title>

    <script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
    <script type="text/javascript">
    $(function(){
      setInterval("GetTime()",1000);
    })
   
    function GetTime()
    {
      var mon,day,now,hour,min,ampm,time,str,tz,end,beg,sec;               
      mon=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");             
      day=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");              
      now=new Date();
      hour = now.getHours();
      min = now.getMinutes();
      sec = now.getSeconds();
      if(hour<10)
      {
         hour="0"+hour;
      }           
      if(min<10)
      {
            min="0"+min;
      }
      if(sec<10)
      {
         sec="0"+sec;
      }
      $("#Timer").html("<nobr>"+day[now.getDay()]+", "+mon[now.getMonth()]+" "+now.getDate()+", "+now.getFullYear() +" "+hour+":"+min+":"+sec+"</nobr>");
    }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div style="background: pink; width:200px;" id="Timer">
            </div>
        </div>
    </form>
</body>
</html>

posted @ 2010-12-28 11:22  你妹的sb  阅读(508)  评论(0编辑  收藏  举报
百度一下