整理一些常用js
来源:互联网 发布:网络远程教育大学 编辑:程序博客网 时间:2024/06/05 08:41
1、js中将后台传来的timestamp转为指定格式
//日期转换方法Date.prototype.format = function(format) { /* * eg:format="yyyy-MM-dd hh:mm:ss"; * (new Date(app.ctime)).format("yyyy-MM-dd hh:mm:ss") */ var o = { "M+" : this.getMonth() + 1, // month "d+" : this.getDate(), // day "h+" : this.getHours(), // hour "m+" : this.getMinutes(), // minute "s+" : this.getSeconds(), // second "q+" : Math.floor((this.getMonth() + 3) / 3), // quarter "S" : this.getMilliseconds() // millisecond } if (/(y+)/.test(format)) { format = format.replace(RegExp.$1, (this.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; }2、通用的序列化form
/* 工具方法 *///序列化表单function serializeForm(form) {var obj = {};$.each(form.serializeArray(), function(index) {if (obj[this['name']]) {obj[this['name']] = obj[this['name']] + ',' + $.trim(this['value']);} else {obj[this['name']] = $.trim(this['value']);}});return obj;}
3、公用的jsp
<%@include file="../taglibs.jsp"%>
4、包含头尾
<%@include file="../layout/head.jsp" %>
0 0
- 整理一些常用js
- 一些常用的JS自定义函数整理
- [cocos2d-js教程】cocos2d-js中一些常用函数整理
- 整理的一些常用的js表单验证
- js常用整理收集
- JS 常用函数整理
- js常用函数整理
- 常用js整理
- 部分常用JS整理
- js常用函数整理
- js常用事件整理
- 常用js整理
- 常用js函数整理
- 常用JS验证整理
- js常用方法整理
- 常用js整理
- 常用JS正则整理
- js常用方法整理
- react系列-bind this
- Linux设备驱动总线模型简介
- 司机体验准备
- JavaScript_基础_window对象
- MAC中设置redis
- 整理一些常用js
- 爱因斯坦与玻尔:两个人的一百年
- 14.5 Interrupt中断的使用
- Mybatis3+Spring4+SpringMVC4 框架整合环境搭建
- 螺旋方阵
- 阿里云 CentOs 6.5 静默安装oracle11g
- Teradata的SQL命令
- git 远程版本库,github提供服务原理,git自动更新发送邮件
- UVa 101 - The Blocks Problem