WEB显示(隐藏)系统时间
<!DOCTYPE html> <html> <head> <title>setinterval.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <script type="text/javascript"> function begintime() { timeID = setInterval("getTime()", 1000); } function getTime() { var date = new Date(); var day = date.getDay(); if (day == 0) { day = "日"; } var Localtime = date.getFullYear() + "年" + " " + date.getMonth() + "月 " + date.getDate() + "日 " + "星期 " + day + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + "<br>"; document.getElementById("time").innerHTML = Localtime; document.getElementById("stoptime").style.display = "block"; document.getElementById("showTime").style.display = "block"; } function stoptime() { clearInterval(timeID); document.getElementById("stoptime").style.display = "none"; document.getElementById("showTime").style.display = "none"; } </script> </head> <body> This is my HTML page. <br> <br> <br> <input type="button" value="显示当前时间" onclick="begintime()"> <div style="border: 1px bule thin;width: 300px;height: 20px;" id="showTime"> <font id="time" color="red"></font> </div> <div style="display:none;" id="stoptime"> <input type="button" value="停止" onclick="stoptime()"> </div> </body> </html>
web页面实时显示系统时间,可隐藏。(供参考)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。