The time function of JS realizes a electronic table

Source: Internet
Author: User

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "UTF-8">        <title></title>    </Head>    <Bodyonload = "Startime ()">//The purpose of the onload here is that when the page is loaded, it executes the function startime ()         <DivID= "Div"style= "border:1px solid royalblue;floating:left; margin:0 auto; display:inline;"></Div>        <Script>                         //var date=new date ();            //document.write (date);            //document.write (Date.getfullyear ());//The year is the output            //document.write (Date.getday ());//output is the specific day of the week            //document.write (Date.gettime ());//The output is a timestamp            //date.setfullyear (2011,2,3);//Set the time yourself            //document.write (date);            functionStartime () {varT=NewDate (); //Create a Date object to reference the related date varh=t.gethours (); varm=t.getminutes (); vars=t.getseconds (); document.getElementById ("Div"). InnerHTML=h+':'+m+':'+s; M=Checktime (m); S=Checktime (s); T=SetTimeout ("Startime ()", - ); //Note the use of the parameters of the function, the first parameter is to be quoted, here is the recall of the original function, the implementation of the Refresh function
The second parameter is the time of the refresh, 500 represents 0.5 seconds } functionChecktime (i) {//Here just for the sake of beauty, in front of the single digit, the display of the number + a 0 if(i<Ten) {i="0"+i; } returni; } </Script> </Body></HTML><!--[email protected] Time: 2017-03-11 Description: Timestamp definition: Time stamp refers to GMT January 01, 1970 00:00 00 seconds (Beijing time January 01, 1970 08:00 00 seconds) The total number of seconds to present. -

The time function of JS realizes a electronic table

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.