javascript显示年月日时间代码
2014-11-25 11:18
239 查看
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language=Javascript>
function time(){
//获得显示时间的div
t_div = document.getElementById('showtime');
var now=new Date()
//替换div内容
t_div.innerHTML = "现在是"+now.getFullYear()
+"年"+(now.getMonth()+1)+"月"+now.getDate()
+"日"+now.getHours()+"时"+now.getMinutes()
+"分"+now.getSeconds()+"秒";
//等待一秒钟后调用time方法,由于settimeout在time方法内,所以可以无限调用
setTimeout(time,1000);
}
</script>
</head>
<body onload="time()">
<div id="showtime"></div>
<p>查找更多代码,请访问:<a href="http://www.lanrentuku.com/" target="_blank">代码</a></p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language=Javascript>
function time(){
//获得显示时间的div
t_div = document.getElementById('showtime');
var now=new Date()
//替换div内容
t_div.innerHTML = "现在是"+now.getFullYear()
+"年"+(now.getMonth()+1)+"月"+now.getDate()
+"日"+now.getHours()+"时"+now.getMinutes()
+"分"+now.getSeconds()+"秒";
//等待一秒钟后调用time方法,由于settimeout在time方法内,所以可以无限调用
setTimeout(time,1000);
}
</script>
</head>
<body onload="time()">
<div id="showtime"></div>
<p>查找更多代码,请访问:<a href="http://www.lanrentuku.com/" target="_blank">代码</a></p>
</body>
</html>
相关文章推荐
- javascript显示年月日时间代码
- javascript显示年月日时间代码
- javascript显示年月日时间代码(收藏)
- javascript显示年月日时间代码
- 根据地区不同显示时间的javascript代码
- JavaScript实时时间显示的最简单代码
- Javascript 世界时区时间显示代码
- JavaScript显示当然日期和时间即年月日星期和时间
- javascript 时间显示代码集合(Date对象)
- 根据地区不同显示时间的javascript代码
- Javascript 最简单的动态显示当前时间的代码
- 仅2行代码的javascript按指定格式显示日期时间效果
- 用javascript显示时间日期代码
- javascript 显示当前系统时间代码
- 用 javascript显示时间日期代码(来自网上)
- 原创javascript显示时间日期代码
- JavaScript实时时间显示的最简单代码
- JavaScript 显示当然日期和时间,年月日星期和时间
- JSP下取当前时间并显示的代码,jsp年月日显示时间
- Javascript 世界时区时间显示代码