jquery Displays the current date time instance (minutes and seconds)

Source: Internet
Author: User

Then look at the source code:

The code is as follows Copy Code

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> Current Time-ke keeper </title>
<script type= "Text/javascript" src= "/jquery-1.10.2.min.js" ></script>
<style type= "Text/css" >
. date{height:100px;line-height:100px;margin:0 auto;font-family:arial, Helvetica, sans-serif;font-size:24px;
Border:solid 1px #ccc; box-shadow:0 0 3px Rgba (0,0,0,0.3) inset;border-radius:5px;text-shadow:1px 1px 2px rgba (0,0,0,0.3);
. Date strong{padding:0 10px;display:inline-block;height:100px;border-right:solid 1px #ccc;}
</style>
<body>
<p class= "Date" >
<strong id= "Y" ></strong>
<strong id= "MH" ></strong>
<strong id= "td_keleyi_com" ></strong>
<strong id= "D" ></strong>
<strong id= "H" ></strong>
<strong id= "M" ></strong>
<strong id= "S" ></strong>
</p>
<script type= "Text/javascript" >
$ (document). Ready (function () {

SetInterval (showTime, 1000);
function Timer (obj,txt) {
Obj.text (TXT);
}
function ShowTime () {
var today = new Date ();
var weekday=new Array (7)
weekday[0]= "Sunday"
weekday[1]= "Monday"
weekday[2]= "Tuesday"
weekday[3]= "Wednesday"
weekday[4]= "Thursday"
weekday[5]= "Friday"
weekday[6]= "Saturday"
var y=today.getfullyear () + "year";
var month=today.getmonth () + "month";
var td_keleyi_com=today.getdate () + "Day";
var d=weekday[today.getday ()];
var h=today.gethours () + ":";
var m=today.getminutes () + ":";
var s=today.getseconds ();
Timer ($ ("#Y"), Y);
Timer ($ ("#MH"), month);
Timer ($ ("#td_kel" + "eyi_com"), td_keleyi_com);
Timer ($ ("#D"), D);
Timer ($ ("#H"), H);
Timer ($ ("#M"), M);
Timer ($ ("#S"), S);
}
})
</script>
</body>

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.