Details set the countdown to the JS program code

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags ajax code countdown document http javascript name program code

<!--Add the following code to <head> area
<script language= "JavaScript" >
<!--//more JavaScript from Http://www.jzread.com
var differencehour =-1
var differenceminute =-1
var differencesecond =-1
var tday = New Date ("Janu 1, 2006 23:59:59")
var daysms = * * 1000
var hoursms = m * 1000
var Secondms = 60 * 1000
var microsecond = 1000

Function Clock ()
{
var time = new Date ()
var hour = time.gethours ()
var minute = time.getminutes ()
Var Second = Time.getseconds ()
var timevalue = "" + (Hour > 12)? Hour-12:hour)
TimeValue = (Minute < 10)? ": 0": ":" +minute
TimeValue + = (Second <)? ": 0": ":) +second
TimeValue = (hour >12)? PM ": AM")
//Document.formnow.now.value = TimeValue
var converthour = Differencehour
var convertminute = Differenceminute
var convertsecond = Differencesecond
var diffms = Tday.gettime ()-Time.gettime ()
Differencehour = Math.floor (diffms/daysms)
Diffms-= differencehour * daysms
Differenceminute = Math.floor ( diffms/hoursms)
Diffms-= Differenceminute * hoursms
Differencesecond = Math.floor (DIFFMS/SECONDMS)
Diffms- = Differencesecond * Secondms
var dsecs = Math.floor (Diffms/microsecond)
if (Converthour!=) Document.formnow.dd.value=differencehour
If Convertminute!= Differenceminute) Document.formnow.hh.value=differenceminute
if (convertsecond!= differencesecond) Document.formnow.mm.value=differencesecond
Document.formnow.ss.value=dsecs
//Document.formnow.Tnow.value = Differencehour Differenceminute + differencesecond + dsecs
settimeout ("clock ()", 1000)

//End hiding-->

</script>

<!--modification <body> content-->
<body onload= "clock (); return true" >
<!--Add the following code to the <body> area-->

<form name= "Formnow" >
Left <input type= "text" name= "DD" Size=2> Day
<input type= "text" name= "hh" size=2> hours
<input type= "text" name= "MM" size=2> points
<input type= "Text" name= "ss" size=2> Seconds to January 1, 2006 23:59:59!
</form>
Description:<br/>
Each month in English and Chinese <br/><br/>

January january<br/>

February february<br/>

March march<br/>

April april<br/>

May May
<br/>
June jun<br/>

July july<br/>

August august<br/>

September september<br/>

October october<br/>

November november<br/>

December December

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.