Status Bar display time code

Source: Internet
Author: User

<HTML>
<Head>
<Title> webpage effect | linkweb.cn/js | --- status bar rolling time </title>
</Head> <body> check the status bar <br>
<! -- Change the followingCode<Body> </body> added to HTML -->

<Script language = JavaScript>
VaR OSD = ""
OSD + = "";
VaR timer;
VaR MSG = "";
Function scrollmaster (){
MSG = customdatespring (new date ())
Cleartimeout (timer)
MSG + = "" + Showtime () + "" + OSD
For (VAR I = 0; I <100; I ++ ){
MSG = "" + MSG;
}
Scrollme ()
}
Function scrollme (){
Window. Status = MSG;
MSG = msg. substring (1, MSG. Length) + msg. substring (0, 1 );
Timer = setTimeout ("scrollme ()", 200 );
}
Function Showtime (){
VaR now = new date ();
VaR hours = now. gethours ();
VaR minutes = now. getminutes ();
VaR seconds = now. getseconds ();
VaR months = now. getmonth ();
VaR dates = now. getdate ();
VaR years = now. getyear ();
VaR timevalue = ""
Timevalue + = (months> 9 )? "":"")
Timevalue + = (dates> 9 )? "":"")
Timevalue = (months + 1)
Timevalue + = "/" + dates
Timevalue + = "/" + years
VaR ap = "A. M ."
If (hours = 12 ){
AP = "P. M ."
}
If (hours = 0 ){
Hours = 12
}
If (hours> = 13 ){
Hours-= 12;
AP = "P. M ."
}
VaR timevalue2 = "" + hours
Timevalue2 + = (minutes <10 )? ": 0": ":") + minutes + "" + AP
Return timevalue2;
}
Function makearray (n ){
This. Length = N
Return this
}
Monthnames = new makearray (12)
Monthnames [1] = "January"
Monthnames [2] = "February"
Monthnames [3] = "March"
Monthnames [4] = "April"
Monthnames [5] = "May"
Monthnames [6] = "June"
Monthnames [7] = "July"
Monthnames [8] = "August"
Monthnames [9] = "September"
Monthnames [10] = "October"
Monthnames [11] = "November"
Monthnames [12] = "December"
Daysnames = new makearray (7)
Daysnames [1] = "Sunday"
Daysnames [2] = "Monday"
Daysnames [3] = "Tuesday"
Daysnames [4] = "Wednesday"
Daysnames [5] = "Thursday"
Daysnames [6] = "Friday"
Daysnames [7] = "Saturday"
Function customdatespring (onedate ){
VaR theday = daysnames [onedate. getday () + 1]
VaR thedate = onedate. getdate ()
VaR themonth = monthnames [onedate. getmonth () + 1]
VaR dayth = "no"
If (thedate = 1) | (thedate = 21) | (thedate = 31 )){
Dayth = "St ";
}
If (thedate = 2) | (thedate = 22 )){
Dayth = "nd ";
}
If (thedate = 3) | (thedate = 23 )){
Dayth = "RD ";
}
Return theday + "," + themonth + "" + thedate + dayth + ","
}
Scrollmaster ();
</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.