This article describes how to implement the time function of the calculator in Javascript and the related information of the instance. If you need it, refer to the following Javascript calculator:
Series of articles:
JS implementation calculator details and instance code (1)
Detailed description and example of the time function of the calculator implemented by Javascript (2)
Javascript calculator-> add time to add time display in the upper left corner of the screen display area
As follows:
Code
Initialize Javascript Calculator
// Calculator initializes Calculator. prototype. init = function () {this. addTdClick (); // time display this. showDate ();};
Time Display
// Display the time and date Calculator in the upper left corner of the screen display area. prototype. showDate = function () {$ ("result-date "). innerText = new Date (). format ("hh: mm: ss EEE yyyy-MM-dd"); var that = this; if (this. timer) clearTimeout (this. timer); this. timer = setTimeout (function () {that. showDate () ;}, 1000 );};
Time Format
Date. prototype. format = function (dateStr ){}
Obtain the display time by using the timer every second
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!
For more details about how to implement the calculator time function in Javascript and related articles (2), please follow the PHP Chinese network!