dreamweaver倒计时的代码怎么写
答案:2 悬赏:40 手机版
解决时间 2021-03-05 16:33
- 提问者网友:树红树绿
- 2021-03-05 02:11
dreamweaver倒计时的代码怎么写
最佳答案
- 五星知识达人网友:你可爱的野爹
- 2021-03-05 03:30
距离中秋节还有
<br>
<!--倒计时设置代码-->
<script language="JavaScript">
<!-- hide script from old browser
var DifferenceHour = -1
var DifferenceMinute = -1
var DifferenceSecond = -1
var Tday = new Date("September 19, 2013 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">
<!--实现显示-->
<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>
<!--倒计时完毕-->
<br>
<!--倒计时设置代码-->
<script language="JavaScript">
<!-- hide script from old browser
var DifferenceHour = -1
var DifferenceMinute = -1
var DifferenceSecond = -1
var Tday = new Date("September 19, 2013 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">
<!--实现显示-->
<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>
<!--倒计时完毕-->
全部回答
- 1楼网友:举杯邀酒敬孤独
- 2021-03-05 05:00
距离中秋节还有
<br>
<!--倒计时设置代码-->
<script language="JavaScript">
<!-- hide script from old browser
var DifferenceHour = -1
var DifferenceMinute = -1
var DifferenceSecond = -1
var Tday = new Date("September 19, 2013 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 ) ?
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯