JS日期倒序动态(商城一般用)

<html>
<head>
<script type="text/javascript">
function startTime()
{
var today=new Date()
var d=23-today.getDate()
var h=11-today.getHours()
var m=5-today.getMinutes()
var s=60-today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)


if(d=="0"&&h=="0"&&m=="00"&&s=="01"){
document.getElementById('txt').innerHTML=0+"天"+00+":"+00+":"+00
return false;
}
document.getElementById('txt').innerHTML=d+"天"+h+":"+m+":"+s
t=setTimeout('startTime()',1000)
}


function checkTime(i)
{
if (i<10) 
  {i="0" + i}
  return i
}
</script>
</head>


<body οnlοad="startTime()">
<div id="txt"></div>
</body>
</html>
-----------------------------------


form 的textrear
et:最多输入1000个字符@@charmax:1000


--------------------------------------------


js的所有日期方法


var y=today.getFullYear()--获取年
getDate-Returns the day of the month for the specified date. --获取日期
getDay -Returns the day of the week for the specified date. 
getHours -Returns the hour in the specified date. --获取小时
getMinutes -Returns the minutes in the specified date. --获取分钟
getMonth -Returns the month in the specified date. --获取月份(用的时候+1)


组成字符串的时候可以用获取的年与日拼接就好
getSeconds -Returns the seconds in the specified date. 
getTime -Returns the numeric value corresponding to the time for the specified date. 
getTimezoneOffset -Returns the time-zone offset in minutes for the current locale. 
getYear -Returns the year in the specified date. 
parse -Returns the number of milliseconds in a date string since January 1, 1970, 00:00:00, local time. 
setDate -Sets the day of the month for a specified date. 
setHours -Sets the hours for a specified date. 
setMinutes -Sets the minutes for a specified date. 
setMonth -Sets the month for a specified date. 
setSeconds -Sets the seconds for a specified date. 
setTime -Sets the value of a Date object. 
setYear -Sets the year for a specified date. 
toGMTString -Converts a date to a string, using the Internet GMT conventions. 
toLocaleString -Converts a date to a string, using the current locale's conventions. 
UTC -Returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, Universal Coordinated Time (GMT). 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值