JS implements the browser status bar display time, js implements the browser Status Bar

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.