javascript 显示当前系统时间
来源:互联网 发布:纯真ip数据库 mysql 编辑:程序博客网 时间:2024/06/05 14:54
1.在<head></head>中加入下列代码
<script language=JavaScript>
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
function startclock () {
stopclock();
showtime();}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" +((hours >= 12) ? "下午 " : "上午 " )
timeValue += ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
document.clock.thetime.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;}
</SCRIPT>
2.在<body>中加入下列代码
onload=startclock()
3.在显示时间的位置插入下列代码,建议使用表格定位
<form name=clock >
<input name=thetime style="font-size: 9pt;color:#000000;border:0" size=12>
</form>
//只获得当前系统日期的函数
<script language="JavaScript" type="text/javascript">
document.write(new Date().getYear()+"-"+(new Date().getMonth()+1)+"-"+new Date().getDate
());</script>
- javascript 显示当前系统时间
- JavaScript显示当前时间
- javascript 显示当前时间
- 显示当前系统时间
- JS-纯JavaScript代码显示系统当前时间
- JAVASCRIPT动态显示当前时间
- javaScript 实现显示当前时间
- python显示当前系统时间
- matlab 显示系统当前时间
- WPF 显示当前系统时间
- js----显示当前系统时间
- js显示当前系统时间
- Java 显示当前系统时间
- 显示当前的系统时间
- js 显示当前系统时间
- Javascript 获取系统当前时间
- JavaScript - 获取系统当前时间
- JavaScript - 获取系统当前时间
- List接口——ArrayList(Array)
- js判断页面是否加载完毕
- [转]使用Vim + Cscope/Ctags
- mtk
- ALV 操作实例
- javascript 显示当前系统时间
- 索引、唯一索引、聚集索引
- Java Stack Heap
- 学习spring事务模板
- 如何删除GHOST镜像
- IsPostBack深入探讨
- SIM卡相关
- List接口——Vector(Stack)
- Linux系统的硬件驱动程序编写原理