北京奧運會開幕式倒計時代碼
來源:易賢網(wǎng) 閱讀:946 次 日期:2014-09-10 16:44:58
溫馨提示:易賢網(wǎng)小編為您整理了“北京奧運會開幕式倒計時代碼”,方便廣大網(wǎng)友查閱!

<html>

<head>

<title>倒計時測試</title>

<!--倒計時設(shè)置代碼-->

<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") //**倒計時時間點-注意格式

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>

</head>

<!--BODY里面的ONLOAD注意-->

<body onload="clock();return true" text="red">

<!--實現(xiàn)顯示-->

距離北京奧運會開幕還有

<form name="formnow">

<input name="dd" type="text" style="border:0;" size=2>

<input name="hh" type="text" style="border:0;" size=2>

小時

<input name="mm" type="text" style="border:0;" size=2>

<input name="ss" type="text" style="border:0;" size=2>

</form>

<!--倒計時完畢-->

</html>

更多信息請查看IT技術(shù)專欄

更多信息請查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機網(wǎng)站地址:北京奧運會開幕式倒計時代碼

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)