常用js函数
来源:互联网 发布:javascript pdf教程 编辑:程序博客网 时间:2024/06/06 09:41
/**
* Form表单转json,查询用
*/
function form2Json(id) {
var arr = $("#" + id).serializeArray();
var json = new Object();
for (var i = 0; i < arr.length; i++) {
json[arr[i].name] = arr[i].value;
}
return json;
}
/**
* 时间对象的格式化;
*/
function formatDate(date,format) {
if(date==null || date.length==1)
return "";
format = format || "yyyy-MM-dd hh:mm:ss";
date = new Date(date);
var o = {
"M+" : date.getMonth() + 1, // month
"d+" : date.getDate(), // day
"h+" : date.getHours(), // hour
"m+" : date.getMinutes(), // minute
"s+" : date.getSeconds(), // second
"q+" : Math.floor((date.getMonth() + 3) / 3), // quarter
"S" : date.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4
- RegExp.$1.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return format;
}
- 常用js函数CheckData.js
- 常用js函数Common.js
- 常用JS函数
- 常用JS函数
- 常用的JS函数
- [转载]常用JS函数
- JS常用函数
- 常用js函数
- 常用js函数
- 常用js函数
- js常用自定义函数
- js常用函数
- js常用验证函数
- 常用的JS函数
- 常用js(javascript)函数
- js常用函数
- js常用函数
- 常用JS函数
- 以太坊rpc接口调用之nonce
- django LoginView 源码浅析
- ARC下OC对象和CF对象之间的桥接(bridge)
- 关于多屏适配的解决方案
- Redis数据结构详解之List(二)
- 常用js函数
- 经典sql语句大全
- leetcode 313. Super Ugly Number
- 【Tomcat】batch获得war包
- HDU4289 Control 【网络流】
- MySQL 服务日志
- swagger-editor语法
- Unity3D:移除某个组件下的所有子对象(清空列表)
- MySQL 网络访问连接