JS implements the browser status bar display time, js implements the browser Status Bar
This article describes how to display the Time of the browser status bar in JavaScript. We will share this with you for your reference. The details are as follows:
In the past, when I made my personal homepage, I always liked to make my webpage very personal. I made a text on the Internet, and showed greetings on the status bar, or added a time display on the status bar, this code is used to display materials for the current time in the status bar. Firefox does not measure the result, and IE works perfectly.
The running effect is as follows:
The Online Demo address is as follows:
Http://demo.jb51.net/js/2015/js-status-bar-show-time-demo/
The Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> Status Bar time display </TITLE> </HEAD> <script language = "JavaScript"> var timerID = null; var timerRunning = false; function stopclock () {if (timerRunning) clearTimeout (timerID); timerRunning = false;} function showtime () {var now = new Date (); var hours = now. getHours (); var minutes = now. getMinutes (); var seconds = now. getSeconds () var t ImeValue = "" + (hours> 12 )? Hours-12: hours) timeValue + = (minutes <10 )? ": 0": ":") + minutes timeValue + = (seconds <10 )? ": 0": ":") + seconds timeValue + = (hours> = 12 )? "Afternoon": "Morning" window. status = timeValue; timerID = setTimeout ("showtime ()", 1000); timerRunning = true;} function startclock () {stopclock (); showtime ();} </script> <body bgcolor = "#336699" topmargin = "0" leftmargin = "0" onLoad = "startclock ()"> check the lower left corner! The status bar has time to display! </BODY> </HTML>
I hope this article will help you design JavaScript programs.