搜索

最新评论

友情博客

RSS

我的 Blog:
hahasmile 最新的 20 条日志
[转载文章]
[技术文章]
[美工]
[全部都是我!]
全站 Blog:
全站最新的 20 条日志
 
如何在网页中显示目前浏览者电脑的日期与时间

<script language="javascript">
var nowDate,theDate,theDay,theYear,theMonth,theHour,theMin,theSec,timeValue;
function ShowDateTime()
{
weeks=new Array("日","一","二","三","四","五","六");
nowDate=new Date;

theDate=nowDate.getDate();
theDay=weeks[nowDate.getDay()];
theYear=nowDate.getYear();
theMonth=nowDate.getMonth()+1;
theHour=nowDate.getHours();
theMin=nowDate.getMinutes();
if(theMin<10)
{
theMin="0"+theMin;
}
theSec=nowDate.getSeconds();
if(theSec<10)
{
theSec="0"+theSec;
}
timeValue=theYear+"年"+theMonth+"月"+theDate+"日"+"星期"+theDay+""+theHour+":"+theMin+":"+theSec;

         //在标题处显示浏览者机器的系统日期与时间
window.document.title = timeValue;
         //每1秒钟刷新一次系统日期与时间
setTimeout("ShowDateTime()",1000);
}
ShowDateTime();
</script>

hahasmile 发表于 2006-7-6  [所属栏目:技术文章 | 返回首页]
小字体中字体大字体
评论(共 {Count} 条)
{CommentAuthor}:
{CommentTime}
{CommentUrl}
{CommentEmail}
{CommentIp}
{CommentContent}