爪哇岛描述语言实现动态时钟的启动和停止,点击开始按钮,获取当前时间,点击停止按钮,时间停止
!DOCTYPE html html head meta charset=' UTF-8 '标题动态时钟的启动和停止/title/头体背景=' img/2。jpg ' style=' background-repeat :不重复;边距-左侧: 180像素;- 1.显示当前时间2.启动秒表3.停止时钟- h1动态时钟/h1 p当前时间:span id=' clock ' style=' color : # FF0000;'//span /p p输入类型='按钮'值=' start ' onclick=' start()' style=' color : # ff 0000;'/input type=' button ' value=' stop ' onclick=' stop()' style=' color : # FF0000;'//p /body脚本类型=' text/JavaScript ' var timer;函数start(){ //设置定时器(方法的实现,毫秒数)计时器=设置间隔(函数(){ var now=new Date();var time=now。tolocaletimestring();var c=文档。getelementbyid(' clock ');c.innerHTML=时间;},1000);}函数stop(){ //暂停清楚定时器clearInterval(计时器);}/脚本/html效果截图:
更多Java脚本语言时钟特效点击查看:JavaScript时钟特效专题
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。