js写的简单动态显示系统时间

来源:互联网 发布:南风知我意浅云txt下载 编辑:程序博客网 时间:2024/05/21 14:59
<!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=utf-8" /><title>无标题文档</title><script>function startTime(){var today = new Date();var h = today.getHours();var m = today.getMinutes();var s = today.getSeconds();m=checkTime(m);s=checkTime(s);document.getElementById('d1').innerHTML=h+":"+m+":"+s;setTimeout('startTime()',1000);}function checkTime(i){if(i<10){i='0'+i;}return i;}</script></head><body onload="startTime()"><div id="d1">    </div></body></html>

原创粉丝点击