base库插件---form

 $().extend('serialize', function () {
for (var i = 0; i < this.elements.length; i ++) {
var form = this.elements[i];
var parts = {};
for (var i = 0; i < form.elements.length; i ++) {
var filed = form.elements[i];
switch (filed.type) {
case undefined :
case 'submit' :
case 'reset' :
case 'file' :
case 'button' :
break;
case 'radio' :
case 'checkbox' :
if (!filed.selected) break;
case 'select-one' :
case 'select-multiple' :
for (var j = 0; j < filed.options.length; j ++) {
var option = filed.options[j];
if (option.selected) {
var optValue = '';
if (option.hasAttribute) {
optValue = (option.hasAttribute('value') ? option.value : option.text);
} else {
optValue = (option.attributes('value').specified ? option.value : option.text);
}
parts[filed.name] = optValue;
}
}
break;
default :
parts[filed.name] = filed.value;
}
}
return parts;
}
return this;
});
上一篇:Mybatis学习笔记汇总(包括源码和jar包)


下一篇:LODOP获取打印成功,是否加入队列