var week; if (new Date().getDay() == 0) week = "星期日"; if (new Date().getDay() == 1) week = "星期一"; if (new Date().getDay() == 2) week = "星期二"; if (new Date().getDay() == 3) week = &q…
/** * 获取上一个月 * * @date 格式为yyyy-mm-dd的日期,如:2014-01-25 */ function getPreMonth(date) { var arr = date.split('-'); var year = arr[0]; //获取当前日期的年份 var month = arr[1]; //获取当前日期的月份 var day = arr[2]; //获取当前日期的日 var days = new Date(year, month, 0); days = da…
var getCurrentWeek = function (day) { var days = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; //定义数组 var week = []; //获取当前星期X(0-6,0代表星期天) var index = new Date(day).getDay(); //循环 for (va…
1.在讲js获取给定月份的N个月后的日期之前,小颖先给大家讲下getFullYear().getYear()的区别. ①getYear() var d = new Date() console.log(d.getYear()); 打印结果为:116 小颖百度了下,js中Date对象getYear()方法和getFullYear()方法区别,比如:JS中Date对象getYear()方法和getFullYear()方法区别发现很多人写的是: 在IE中是可以正确获取年份:2016,但是在FF等浏览器…
1问题:js get browser vertion (js获取浏览器信息版本) 2解决方案 Copy this script into your JavaScript files. It works immediately, and you can query three properties of the BrowserDetectobject: Browser name: BrowserDetect.browser Browser version: BrowserDetect.versio…
以下为js获取HTTP的全部请求头信息: var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); console.log(headers); 以下为js获取HTTP的部分请求头信息,如日期: var req = new XMLHttpRequest(); re…