<html> <head> <title>时间</title> <meta charset="utf-8"> </head> <body onload="getTime()"> <span id="nowDateTimeSpan" ></span> </body> </html>
//时间
function getTime(){
var ndate = new Date();
var nyear = ndate.getFullYear();
var nmonth = ndate.getMonth()+1;
var nday = ndate.getDate();
var nhour = ndate.getHours();
var nminute = ndate.getMinutes();
var nsecond = ndate.getSeconds();
// 如果分钟或小时的值小于10,则在其值前加0,比如如果时间是下午3点20分9秒的话,则显示15:20:09
nmonth=checkTime(nmonth);
nday=checkTime(nday);
nminute=checkTime(nminute);
nsecond=checkTime(nsecond);
document.getElementById('nowDateTimeSpan').innerHTML=nyear+"-"+nmonth+"-"+nday+" "+nhour+":"+nminute+":"+nsecond;
document.getElementById('nowDateTimeSpan1').innerHTML=nyear+"-"+nmonth+"-"+nday+" "+nhour+":"+nminute+":"+nsecond;
document.getElementById('nowDateTimeSpan2').innerHTML=nyear+"-"+nmonth+"-"+nday+" "+nhour+":"+nminute+":"+nsecond;
document.getElementById('nowDateTimeSpan3').innerHTML=nyear+"-"+nmonth+"-"+nday+" "+nhour+":"+nminute+":"+nsecond;
document.getElementById('nowDateTimeSpan4').innerHTML=nyear+"-"+nmonth+"-"+nday+" "+nhour+":"+nminute+":"+nsecond;
//setTimeout('getTime()',1000);//每一秒中重新加载startTime()方法
function checkTime(i){
if (i<10){
i="0" + i;
}
return i;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有