The example of this article describes the JS implementation form bar to display the full format time clock effect code. Share to everyone for your reference. Specifically as follows:
Here demonstrates the form bar special effects clock, display full date format date effect, can show the days of the week, a few months, the past is directly displayed in the Web page, and this code is to display the time in the form of the text box, look at the code to understand.
The screenshot of the running effect is as follows:
The online demo address is as follows:
http://demo.jb51.net/js/2015/js-form-input-showtime-codes/
The specific code is as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <HTML> <HEAD> <title>form column special full clock </
title> </HEAD> <body bgcolor= "#ffffff" onload= "Startclock ()" > <script language= "JavaScript" >
<!--Hide var timerid = null var timerrunning = False function Makearray (size) {this.length = size;
for (var i = 1; I <= size; i++) {This[i] = "";
return to this;
The function Stopclock () {if (timerrunning) cleartimeout (Timerid);
Timerrunning = false} function Showtime () {var now = new Date ();
var year = Now.getfullyear ();
var month = Now.getmonth () + 1;
var date = Now.getdate ();
var hours = now.gethours ();
var minutes = now.getminutes ();
var seconds = now.getseconds ();
var day = Now.getday ();
Day = new Makearray (7);
Day[0]= "Sunday";
Day[1]= "Monday";
Day[2]= "Tuesday";
Day[3]= "Wednesday";
Day[4]= "Thursday";
Day[5]= "Friday";
Day[6]= "Saturday";
var timevalue = "";
TimeValue + + "year"; TimeValue + + (Month < 10)? "0": "") + month + "Month ";
TimeValue + = date + "Day";
TimeValue + + (Day[day]) + "";
TimeValue + = ((hours <=) hours:hours-12); TimeValue + + (minutes < 10)?
": 0": ":") + minutes; TimeValue + + (seconds < 10)?
": 0": ":") + seconds; TimeValue + = (Hours < 12)?
"The Morning": "The Afternoon";
Document.jsfrm.face.value = TimeValue;
Timerid = settimeout ("Showtime ()", 1000);
Timerrunning = true} function Startclock () {stopclock (); Showtime ()}//--> </script> <form name= ' jsfrm ' > <input type=text ' face ' name= size=34 ' >
;/form> </BODY> </HTML>
The
wants this article to help you with your JavaScript programming.