定时器的使用

1.    setInterval(func, time)  间隔定时器  

timer = setInterval(func, time)     

clearInterval(timer) 关闭定时器


2.    setTimeOut(func, time)    延时定时器

timer = setTimeOut(func, time)     

clearTimeOut(timer) 关闭定时器


3.    日期对象  返回值皆为数字  

 Date = new Date()

Date.getHours()  

Date.getHours()  

Date.getMinites()  

Date.getSeconds()  

Date.getFullYear()  

Date.getMonth()  所得月为当前月减一  所以 +1 为正解

Date.getDate()    得到日 

Date.getDay()   得到星期  且从0开始 对应周日

  

4.    头像与头像对应资料的延迟显示

    在两个DIV间合理交互使用setTimeOut() 与 clearTimeOut()


5.    设置图像滚动

    setInterval()

    通过设置offSetLeft 与定时器结合   达到定时平移效果



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值