标题:怎样在HTML中用JS显示当前时间
只看楼主
zc102520
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-7-26
 问题点数:0 回复次数:2 
怎样在HTML中用JS显示当前时间
怎样在HTML中用JS显示当前时间怎样在HTML中用JS显示当前时间
搜索更多相关主题的帖子: HTML 时间 
2008-07-26 23:14
liaofengxian
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2008-7-14
得分:0 
var nowDate=new Date();
document.write(nowDate);

当然,这个没有控制显示的样式,你要让显示出来的内容变成你想要的样式的话,可以是
document.write(nowDate.getYear()+"年"+(nowDate.getMonth()+1)+"月"+nowDate.getDate()+"日 "+nowDate.getHours()+":"+nowDate.getMinutes()+":"+nowDate.getSeconds());
2008-07-26 23:54
liaofengxian
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2008-7-14
得分:0 
var nowDate=new Date();
document.write(nowDate);

当然,这个没有控制显示的样式,你要让显示出来的内容变成你想要的样式的话,可以是
document.write(nowDate.getYear()+"年"+(nowDate.getMonth()+1)+"月"+nowDate.getDate()+"日 "+nowDate.getHours()+":"+nowDate.getMinutes()+":"+nowDate.getSeconds());
2008-07-26 23:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-225388-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.778072 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved