The opening of the Beijing 2008 Olympic Games special effects JS code

Source: Internet
Author: User

From the opening of the Beijing 2008 Olympic Games, the special effects, a simple demonstration!

From the opening of the Beijing Olympic Games
<br>
<title> Countdown Test </title>
<!--countdown Set code-->
<script language= "JavaScript" >
<!--hide script from old browser
var differencehour =-1
var differenceminute =-1
var Differencesecond =-1
var tday = new Date ("Aug 8, 2008 20:00:00")//** countdown time Point-note format
var daysms = 24 * 60 * 60 * 1000
var hoursms = 60 * 60 * 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 < 10)? ": 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!= differencehour) 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>
<!--the onload inside the body notice-->
<body onload= "clock (); return true" text= "Red" >
<!--implementation display-->
<form name= "Formnow" >
<input name= "dd" type= "text" style= "border:0;" size=2>
Days
<input name= "hh" type= "text" style= "border:0;"
Hours
<input name= "MM" type= "text" style= "border:0;" size=2>
Part
<input name= "ss" type= "text" style= "border:0;" size=2>
Seconds
</form>
<!--Countdown is complete-->

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.