1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > html时间日期 年月日时分秒 年月日时分秒的即时显示

html时间日期 年月日时分秒 年月日时分秒的即时显示

时间:2023-12-13 23:30:09

相关推荐

html时间日期 年月日时分秒 年月日时分秒的即时显示

网页特效观止||---年月日时分秒的即时显示

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 = now.getYear()+"年"+(now.getMonth()+1)+"月"+now.getDate()+"日" +((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;}

提示:可以修改后运行.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。