/** 自定义一个序列化表单的方法* */
$.fn.serializeObject = function() {
var o = {};
$(this).find("input").each(function(index) {
if ($(this).attr("name") != undefined) {
if ($(this).attr("type") == "text" || $(this).attr("type") == "password" || $(this).attr("type") == "hidden") {
o[$(this).attr("name")] = $(this).val();
//alert($(this).attr("name")+" : "+$(this).val());
}
if ($(this).attr("type") == "radio") {
if ($(this).is(":checked")) {
o[$(this).attr("name")] = $(this).attr("value");
}
}
if ($(this).attr("type") == "checkbox") {
if ($(this).is(":checked")) {
o[$(this).attr("name")] = $(this).attr("value");
}
}
}
});
$(this).find("select").each(function(index) {
if ($(this).attr("name") != undefined) {
o[$(this).attr("name")] = $(this).val();
}
});
$(this).find("textarea").each(function(index) {
if ($(this).attr("name") != undefined) {
o[$(this).attr("name")] = $(this).val();
}
});
return o;
};