Tag:开源 , 源码 , 控件 , 控件开发 , 皮肤 , Skin , MVC , WCF , Remoting , AJAX , JQuery , Flex , Silverlight , SQL Server , 设计模式 , 框架 , 正则 , Web服务 , 数据库 , PetShop , WordPress , jquery 显示年月日,星期,时分秒

 
您的位置: >> 首页 >> .Net博文 >> jquery 显示年月日,星期,时分秒

jquery 显示年月日,星期,时分秒

2011-02-02  来自:博客园  字体大小:【  
  • 摘要:本文为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>


作者:夏楚枫
相关文章:
该文章已有条评论 我要发表评论