JavaScript一些备忘知识

currentStyle,getComputedStyle获取非行间样式,兼容性问题。

定时器:

setInterval(执行方法,间隔时间);每隔指定时间执行一次给定的方法

setTimeout(执行方法,隔多久执行);隔指定时间后执行方法,只执行一次。

关闭定时器:

clearInterval(定时器)

clearTimeout(定时器)

js中获取时间:date对象

var oDate=new Date();

oDate.getFullYear();

oDate.getHours()+1;

oDate.getDate();

oDate.getDay();//获得星期几

oDate.getHours();

oDate.getMinutes();

oDate.getSecond s();

直接使用数组中的arr[i]会有兼容性问题,用charAt()

原文地址:https://www.cnblogs.com/mhdtysp/p/3681979.html