How many days of code running on the website + CSS style

Source: Internet
Author: User

In the tutorial of (www.bkjia.com), some websites are placed at the bottom or sidebar of the webpage, for example, "the website has been running for xx days." Some webmasters asked me how to implement it, in fact, this is not difficult. Let's share the instance code with you.

First look at the HTML section:

Reference content is as follows:
<Div class = "yunxing">
The website is running
<Span id = "span_dt_dt" style = 'border: 0px solid black; background-color: # ffff'> </span>
<SCRIPT language = javascript>
<! --
// Document. write ("");
Function show_date_time (){
Window. setTimeout ("show_date_time ()", 1000 );
BirthDay = new Date ("07-31-2009"); // the Helper's house prompts: 07-31-2009 indicates the site creation Date.
Today = new Date ();
Timeold = (today. getTime ()-BirthDay. getTime ());
Sectimeold = timeolder/1000
Secondsold = Math. floor (sectimeold );
MsPerDay = 24*60x60*1000
E_daysold = timeold/msPerDay
Daysold = Math. floor (e_daysold );
E_hrsold = (daysold-e_daysold) *-24;
Hrsold = Math. floor (e_hrsold );
E_minsold = (hrsold-e_hrsold) *-60;
Minsold = Math. floor (hrsold-e_hrsold) *-60 );
Seconds = Math. floor (minsold-e_minsold) *-60 );
Span_dt_dt.innerHTML = daysold + "day" + hrsold + "Hour" + minsold + "Minute" + seconds + "second ";
}
Show_date_time ();
// -->
</SCRIPT>
</Div>

The following is the CSS part (put it in the head or css file of the webpage ):

Reference content is as follows:
Yunxing {clear: both; text-align: center; border: 1px solid # 0099FF; background: # FFFFFF; line-height: 20px; padding: 6px 5px 3px; color: #666 ;}

Related Article

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.