主要注意一下几点,就可以了:
(1)用date方法进行时间计算,Date(year,month -1 , day)构造指定日期。
(2)new Date()获得现在的时间。
(3)用date计算两个毫秒差异,然后计算日、时、分、秒。
(4)用setInterval方法延迟启动一个js方法,没秒执行一次更新。
代码如下:
<!DOCTYPE html><html>
<head>
<meta charset="gb2312"></meta>
<title>倒计时</title>
<script>
function timer(){
var now = new Date()
var endDate = new Date("2015", "03", "01")
var leftTime = endDate.getTime()- now.getTime()
var leftsecond = parseInt(leftTime/1000)
//var day1=parseInt(leftsecond/(24*60*60*6))
var day1=Math.floor(leftsecond/(60*60*24))
var hour=Math.floor((leftsecond-day1*24*60*60)/3600)
var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60)
var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60)
document.getElementById("timer").innerHTML = day1 + "天" + hour + "时" + minute + "分" + second + "秒"
//每一秒执行一次 timer方法
setInterval("timer()",1000)
}
</script>
</head>
<body onload = "timer()">
距离2015-4-1日还有:
<div id="timer"></div>
</body>
</html>
小窝模式_竖向半边、半隐藏导航代码适合黑色皮肤
javascript:window.top.space_addItem(13,6799,24,348,19,190,0)
适合白色皮肤
javascript:window.top.space_addItem(13,6115,913,264,30,230,0)
橘黄小格子方块导航
javascript:window.top.space_addItem(13,5683,3,321,7,400,0)
球球导航
javascript:window.top.space_addItem(13,4727,228,297,30,380,0)
蓝导航
javascript:window.top.space_addItem(13,25540,30,110,25,600,20)
黑半球
javascript:window.top.space_addItem(13,13435,226,344,25,400,0)
黑色竖半条
javascript:window.top.space_addItem(13,7809,280,280,27,310,0)
灰色竖半边
javascript:window.top.space_addItem(13,23935,89,374,44,225,0)
白色半歪竖
javascript:window.top.space_addItem(13,23403,862,344,29,165,0)
透明水晶竖半边
javascript:window.top.space_addItem(13,23117,118,356,45,200,0)
王冠
javascript:window.top.space_addItem(13,25302,0,0,53,450,0)
适合粉红皮肤
javascript:window.top.space_addItem(13,11841,0,0,29,370,0)
这个舒服
javascript:window.top.space_addItem(13,7769,0,0,29,300,0)
边上带点红条
javascript:window.top.space_addItem(13,7369,0,0,29,330,0)
适合红色皮肤
javascript:window.top.space_addItem(13,26964,0,0,45,300,0)
空间flash挂件代码
javascript:window.top.space_addItem(16,31717,0,0,400,35,0)圈圈外阔
javascript:window.top.space_addItem(16,27932,300,140,300,80,200)上下动来动去
javascript:window.top.space_addItem(16,27906,350,100,580,40,200)下雨了
javascript:window.top.space_addItem(16,31713,0,0,440,30,0)(猫咪)
javascript:window.top.space_addItem(16,30117,0,0,440,40,0)(往上飘)
javascript:window.top.space_addItem(16,28207,0,0,440,30,0)(爱心)
javascript:window.top.space_addItem(16,27931,0,0,440,30,0)(十字架,跑来跑去)
javascript:window.top.space_addItem(16,27785,0,0,440,35,0)(粉色往上飘)
javascript:window.top.space_addItem(16,27868,0,0,440,28,0)(箭头走动)
我知道!是空间掩饰标志代码,不过是黄钻用的。一楼的,你不懂啦。呵呵。。。给你哈javascript:window.top.space_addItem(16,27872,0,0,20,20,0) 一个彩色方块
javascript:window.top.space_addItem(16,27635,100,40,50,50,0)一粒闪钻
javascript:window.top.space_addItem(16,27615,51,3,30,205,100) 微闪
javascript:window.top.space_addItem(6,40250,-81,18,0,0,0)
弄上去后移动到上面就可以勒
呵呵。我够意思吧!!
不过怎么没分啊。开玩笑的!不用啦