滚动帧听和获取时间【Javascript】

时间:2019-09-23 发布者: 访问量:3497

滚动帧监听:

window.onscroll=function(){ 
if(document.body.scrollTop>500){
 alert('滚动大于500了') }else{ } }

获取时间:

 
/**
* 获得当前时间数组
* 顺序: 年,月,日,时,分,秒,星期几,时间戳
*/
 dui.getCurrentTime()[0];
/**
 * 获得当前时间
 */
getCurrentTime:function(){
var oDate = new Date();
var aDate = [];
aDate.push(oDate.getFullYear());
aDate.push(oDate.getMonth()+1);
aDate.push(oDate.getDate());
aDate.push(oDate.getHours());
aDate.push(oDate.getMinutes());
aDate.push(oDate.getSeconds());
aDate.push(oDate.getDay());
aDate.push(oDate.getTime());
return aDate;
}
发布于
  用户评论
    生活编程