js/jQuery的小方法
来源:互联网 发布:mac模拟人生2中文 编辑:程序博客网 时间:2024/05/21 00:01
获取当前日期是当年中的第几周
function getCurrentWeek() {
var totalDays = 0;var now = new Date();
var years = now.getYear(); if (years < 1000) years += 1900;
var days = new Array(12);
days[0] = 31;
days[2] = 31;
days[3] = 30;
days[4] = 31;
days[5] = 30;
days[6] = 31;
days[7] = 31;
days[8] = 30;
days[9] = 31;
days[10] = 30;
days[11] = 31;
//判断是否为闰年,针对2月的天数进行计算
if (Math.round(now.getYear() / 4) == now.getYear() / 4) {
days[1] = 29
} else {
days[1] = 28
}
if (now.getMonth() == 0) {
totalDays = totalDays + now.getDate();
} else {
var curMonth = now.getMonth();
for (var count = 1; count <= curMonth; count++) {
totalDays = totalDays + days[count - 1];
}
totalDays = totalDays + now.getDate();
}
//得到第几周
var currentWeek = Math.round(totalDays / 7);
alert("当前是第:"+week +" 周");
return currentWeek;
}
//判断当前日期为当年第几周
var getYearWeek = function (a, b, c) {
var date1 = new Date(a, parseInt(b) - 1, c), date2 = new Date(a, 0, 1),
d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
return Math.ceil((d + ((date2.getDay() + 1) - 1)) / 7);
};
手机下滑到底端,然后执行代码
<!--向下翻页-->
$(window).scroll(function(){
var windowHeight = parseFloat($(window).height());
var scrollHeight = parseFloat($(window).scrollTop());
var totalheight = windowHeight + scrollHeight;
//$(".content").css("height",totalheight);
if ($(document).height() <= totalheight) {
if (flag) {
currentPage = currentPage + 1;
$("#page_tag_load").show();
flag = false;
setTimeout('getSalePlanList('+ currentPage + ','+ findtype + ')', 1000);
}
}
});
- js/jQuery的小方法
- 常用的js小方法
- jquery、js小知识
- JQuery的一些有用的小方法
- 关于jQuery的一些小方法
- JS/JQuery的一些方法的使用
- jquery 常用小方法
- jquery 杂七杂八小方法
- js中Math方法的小技巧
- 小程序引入WxValidate.js的方法
- js ,jQuery 操作属性的相关方法
- js/JQuery中遍历数组的方法
- 扩展JQuery和JS的方法
- 纯js 替换 jquery 的方法
- js、jQuery中常用的一些方法
- JQuery each打印JS对象的方法
- JS原生方法实现jQuery的ready()
- js/jquery判断浏览器的方法小结
- 删除文件夹下的所有文件
- 面向对象设计-----属性类型 读取属性特性
- win32 dll中使用cstring
- 乐视云 API
- OpenBLAS项目与矩阵乘法优化 | AI 研习社
- js/jQuery的小方法
- 浅谈中文域名
- 直播+风口来临,首富之子悄然布局,又将成就一大批千万富翁!
- 高并发与分布式系统的基石--数据库读写分离实战
- Spring事务学习笔记
- 读Zepto源码之IOS3模块
- 若要再次显示该网页 web 浏览器需要重新
- C++ 虚基类的定义、功能、规定
- SpringMVC详细示例实战教程(二)